ViewModel.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using PP_Ven_MosS.ModelBase;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.Entity;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace PP_Ven_MosS.Classes
  9. {
  10. public class Events
  11. {
  12. public List<Event> eve;
  13. public Events()
  14. {
  15. eve = newevent();
  16. }
  17. public List<Event> newevent()
  18. {
  19. List<Event> events = new List<Event>();
  20. Event buff;
  21. List<Event> bdevent = Database.entities.Event.ToList();
  22. foreach (Event evn in bdevent)
  23. {
  24. buff = new Event();
  25. buff.Id_event = evn.Id_event;
  26. buff.Title_event = evn.Title_event;
  27. buff.Description_event = evn.Description_event;
  28. }
  29. return events;
  30. }
  31. public class Users
  32. {
  33. public List<User> usr;
  34. public Users()
  35. {
  36. usr = newuser();
  37. }
  38. public List<User> newuser()
  39. {
  40. List<User> users = new List<User>();
  41. User buff;
  42. List<User> bdusers = Database.entities.User.ToList();
  43. foreach (User user in bdusers)
  44. {
  45. buff = new User();
  46. buff.Id_user = user.Id_user;
  47. buff.Surname = user.Surname;
  48. buff.Name = user.Name;
  49. buff.Patronymic = user.Patronymic;
  50. buff.Post = user.Post;
  51. buff.Phone_number = user.Phone_number;
  52. buff.Login = user.Login;
  53. buff.Password = user.Password;
  54. users.Add(buff);
  55. }
  56. return users;
  57. }
  58. }
  59. }
  60. }