private async Task UpdatePages(bool Admin) { if (IsAdmin) { lstPages.Add(new MasterPageItem { Id = 4, Title = "Agregar vehículo", IconSource = "car.png" }); lstReceived = await ReceiveCarModel.GetCars(); lstPages.Add(new MasterPageItem { Id = 5, Title = "Ver Consultas", IconSource = "car.png" }); } else { var itemToRemove = lstPages.SingleOrDefault(r => r.Id == 4); if (itemToRemove != null) { lstPages.Remove(itemToRemove); } itemToRemove = lstPages.SingleOrDefault(r => r.Id == 5); if (itemToRemove != null) { lstPages.Remove(itemToRemove); } } }
private async void ReceiveCar() { ReceiveCarModel car = new ReceiveCarModel(); car.Brand = CarBrand; car.Model = CarModelo; car.Year = CarYear; car.Miles = CarMiles; car.Damage = CarDamage; car.lstImagenes = lstImages; string saved = ""; saved = await ReceiveCarModel.SaveCar(car, UserId); lstImages = new ObservableCollection <ImageFile>(); if (Int32.Parse(saved) > 0) { lstImages = new ObservableCollection <ImageFile>(); CarBrand = ""; CarModelo = ""; CarYear = 0; CarMiles = 0; CarDamage = ""; lstReceived = await ReceiveCarModel.GetCars(); App.Current.MainPage.DisplayAlert("Success", "Su Consulta ha sido enviada", "OK"); PageManager(1); } else { App.Current.MainPage.DisplayAlert("Error", "Se ha generado un error.", "OK"); } }