12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ModelExam
- {
- /// <summary>
- /// Работа и взаимодействие с ViewModel
- /// </summary>
- class ViewModel
- {
- public List<users> user;
- public void User()
- {
- user = Newuser();
- }
- public List<users> Newuser()
- {
- List<users> allusers = new List<users>();
- List<users> bdusers = Base.entities.users.ToList();
- users buff;
- foreach (var users in bdusers)
- {
- buff = new users();
- buff.id = users.id;
- buff.surname = users.surname;
- buff.firstname = users.firstname;
- buff.patronymic = users.patronymic;
- buff.id_post = users.id_post;
- buff.email = users.email;
- buff.password = users.password;
- posts post = Base.entities.posts.FirstOrDefault(x => x.id == users.id);
- // buff.idpost = post.title;
- allusers.Add(buff);
- }
- return allusers;
- }
- public class Usersmetrics
- {
- public List<usersmetrics> um = new List<usersmetrics>();
- public void Usersmetric()
- {
- um = Usermetric();
- }
- public List<usersmetrics> Usermetric()
- {
- List<usersmetrics> allusersmetrics = new List<usersmetrics>();
- List<usersmetrics> bdusersmetrics = Base.entities.usersmetrics.ToList();
- usersmetrics buff;
- foreach (var users in bdusersmetrics)
- {
- buff = new usersmetrics();
- buff.id = users.id;
- buff.id_user = users.id_user;
- buff.id_metric = users.id_metric;
- buff.coefficient = users.coefficient;
- buff.dateofachievement = users.dateofachievement;
- users usermetrics = Base.entities.users.FirstOrDefault(x => x.id == users.id_metric);
- buff.id_metric = usermetrics.id;//.title;
- metrics met = Base.entities.metrics.FirstOrDefault(x => x.id == users.id_metric);
- //buff.metrics = met.metric;//.title;
- allusersmetrics.Add(buff);
- }
- return allusersmetrics;
- }
- }
- }
- }
|