protected CrudViewModelBase(string entityEndpoint) { DeleteCommand = new AsyncCommandBase(Delete); UpdateCommand = new AsyncCommandBase(Update); CreateCommand = new AsyncCommandBase(Create); CreateModeCommand = new Command(CreateCommandMethod); CreateEntity = new T1(); Entities = new ObservableCollection <T>(); WebApiEntityService = new WebApiEntityService <T, T1>(entityEndpoint); Initialization = Initialize(); }
protected override async Task InitializeData() { var crewService = new WebApiEntityService <Crew, EditableCrewFields>("crews"); var flightService = new WebApiEntityService <Flight, EditableFlightFields>("flights"); var planeService = new WebApiEntityService <Plane, EditablePlaneFields>("planes"); Planes = new ObservableCollection <Plane>(await planeService.GetAll()); Crews = new ObservableCollection <Crew>(await crewService.GetAll()); Flights = new ObservableCollection <Flight>(await flightService.GetAll()); OnPropertyChanged(nameof(SelectedEntity)); }