using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelExam
{
///
/// Работа и взаимодействие с ViewModel
///
class ViewModel
{
public List user;
public void User()
{
user = Newuser();
}
public List Newuser()
{
List allusers = new List();
List 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 um = new List();
public void Usersmetric()
{
um = Usermetric();
}
public List Usermetric()
{
List allusersmetrics = new List();
List 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;
}
}
}
}