EditEmployeeViewModel.cs 668 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Acosta.Models;
  5. using Acosta.Views;
  6. using Avalonia.Controls;
  7. using Microsoft.EntityFrameworkCore;
  8. using ReactiveUI;
  9. namespace Acosta.ViewModels
  10. {
  11. public class EditEmployeeViewModel : ReactiveObject
  12. {
  13. SuharevaContext myC;
  14. Employee? currentUser;
  15. public EditEmployeeViewModel(SuharevaContext myC, int userId)
  16. {
  17. this.myC = myC;
  18. currentUser = myC.Employees.Include(x => x.RoleNavigation).FirstOrDefault(x => x.Employeesid == userId);
  19. }
  20. public Employee? CurrentUser { get => currentUser; set => currentUser = value; }
  21. }
  22. }