UserProfileViewModel.cs 1019 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using AvaloniaExample.Models;
  5. using Microsoft.EntityFrameworkCore;
  6. using ReactiveUI;
  7. namespace AvaloniaExample.ViewModels
  8. {
  9. public class UserProfileViewModel : ReactiveObject
  10. {
  11. UsersContext connect;
  12. Login userInf;
  13. public Login UserInf { get => userInf; set => this.RaiseAndSetIfChanged(ref userInf, value); }
  14. public List<string> GenderList => new List<string>{ "ìóæ÷èíà", "æåíùèíà" };
  15. //public string Gender { get => UserInf.UsersInfo.Gender; set => UserInf.UsersInfo.Gender =value; }
  16. public UserProfileViewModel(UsersContext dbConnect, string userLogin)
  17. {
  18. connect = dbConnect;
  19. userInf = connect.Logins.Include(x => x.UsersInfo).FirstOrDefault(x => x.Value == userLogin);
  20. }
  21. public string DateBirth { get => userInf.UsersInfo.DateBirth.ToString(); set => userInf.UsersInfo.DateBirth = DateOnly.FromDateTime(DateTime.Parse(value)); }
  22. }
  23. }