EditOutletViewModel.cs 678 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 EditOutletViewModel : ReactiveObject
  12. {
  13. SuharevaContext myC;
  14. Outlet? currentOutlet;
  15. public EditOutletViewModel(SuharevaContext myC, int outletId)
  16. {
  17. this.myC = myC;
  18. CurrentOutlet = myC.Outlets.Include(x => x.TradeNetworksNavigation).FirstOrDefault(x => x.Outletid == outletId);
  19. }
  20. public Outlet? CurrentOutlet { get => currentOutlet; set => currentOutlet = value; }
  21. }
  22. }