using System; using System.Collections.Generic; using System.Linq; using Avalonia.Media.Imaging; using Microsoft.EntityFrameworkCore; using reactivepril.Models; using ReactiveUI; namespace reactivepril.ViewModels { public class Page2NextViewModel : ViewModelBase { Galochkin41pContext db = new Galochkin41pContext(); User currentUser; Bitmap imgage; public User CurrentUser { get => currentUser; set => this.RaiseAndSetIfChanged(ref currentUser, value); } public Bitmap Imgage { get => imgage; set => this.RaiseAndSetIfChanged(ref imgage, value); } public Page2NextViewModel(int idUser) { CurrentUser = db.Users.Include(x => x.GendersNavigation).Include(x => x.RolesNavigation).FirstOrDefault(x => x.UserId == idUser); } public void GoBack() => MainWindowViewModel.Self.Page = new Page1(); public List Genders => db.Genders.Select(x => x.NameGender).ToList(); public string GenderIndex { get => currentUser.GendersNavigation.NameGender; set => currentUser.Genders = db.Genders.FirstOrDefault(x => x.NameGender == value).IdGender; } } }