using System; using System.IO; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Met_Fam { public partial class Goods { private string typeOfGoods; public string TypeOfGoods { get { return typeOfGoods; } set { typeOfGoods = value; } } } public partial class Goods { private int countfForBuing = 1; public int CountfForBuing { get { return countfForBuing; } set { countfForBuing = value; } } } public class Product { public List gds; public Product() { gds = product(); } public List product() { List goods = new List(); Goods buff; List bdgoods = DataBase.BaseModel.Goods.ToList(); foreach (Goods good in bdgoods) { buff = new Goods(); buff.ID_Goods = good.ID_Goods; buff.Title_Goods = good.Title_Goods; buff.Price_Goods = good.Price_Goods; buff.Buying_Goods = good.Buying_Goods; buff.Picture = good.Picture; buff.Description = good.Description; buff.ID_Type_Goods = good.ID_Type_Goods; Type_Goods type_Goods = DataBase.BaseModel.Type_Goods.FirstOrDefault(x => x.ID_Type_Goods == good.ID_Type_Goods); buff.TypeOfGoods = type_Goods.Title_Type_Goods; goods.Add(buff); } return goods; } } public class Users { public List usr; public Users() { usr = newuser(); } public List newuser() { List users = new List(); User buff; List bdusers = DataBase.BaseModel.User.ToList(); foreach (User user in bdusers) { buff = new User(); buff.ID_User = user.ID_User; buff.Surname_User = user.Surname_User; buff.Name_User = user.Name_User; buff.Login_User = user.Login_User; buff.Password_User = user.Password_User; buff.Phone_User = user.Phone_User; buff.Address = user.Address; buff.ID_Role = user.ID_Role; users.Add(buff); } return users; } } public class Video { public List videos; List buingVM; public Video(List buing) { buingVM = buing; videos = newvideo(); } public List newvideo() { List video = new List(); Videos buff; List bdvideos = DataBase.BaseModel.Videos.ToList(); foreach (Videos vid in bdvideos) { buff = new Videos(); buff.ID_Video = vid.ID_Video; buff.Video = vid.Video; buff.ID_User = vid.ID_User; buff.ID_Goods = vid.ID_Goods; foreach (int i in buingVM) { if (i == buff.ID_Goods) { video.Add(buff); } } } return video; } } public class BGoods { public List bg; public BGoods() { bg = newvideo(); } public List newvideo() { List bgood = new List(); Buying_Goods buff; List bdvideos = DataBase.BaseModel.Buying_Goods.ToList(); foreach (Buying_Goods vid in bdvideos) { buff = new Buying_Goods(); buff.ID_Buying_Goods = vid.ID_Buying_Goods; buff.ID_Goods = vid.ID_Goods; buff.ID_User = vid.ID_User; buff.Data_Buying_Goods = vid.Data_Buying_Goods; buff.Quantity = vid.Quantity; bgood.Add(buff); } return bgood; } } }