OutletsListViewModel.cs 725 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Acosta.Models;
  5. using Microsoft.EntityFrameworkCore;
  6. using ReactiveUI;
  7. namespace Acosta.ViewModels
  8. {
  9. public class OutletsListViewModel : ReactiveObject
  10. {
  11. SuharevaContext myConnection;
  12. Outlet? currentOutlet;
  13. public OutletsListViewModel(SuharevaContext myConnection)
  14. {
  15. this.myConnection = myConnection;
  16. CurrentOutlet = myConnection.Outlets.Include(x => x.TradeNetworksNavigation).FirstOrDefault();
  17. }
  18. public List<TradeNetwork> ListTrades => myConnection.TradeNetworks.ToList();
  19. public Outlet? CurrentOutlet { get => currentOutlet; set => currentOutlet = value; }
  20. }
  21. }