OutletsListViewModel.cs 758 B

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