public async Task <ActionResult> Edit(int id, PlatoViewModel vm) { if (id != vm.Id) { return(NotFound()); } var plato = await _repository.GetById(vm.Id); if (plato == null) { return(NotFound()); } if (ModelState.IsValid) { plato.NombrePlato = vm.NombrePlato; plato.Ingredientes = vm.Ingredientes; plato.Precio = vm.Precio; plato.CantidadPersonas = vm.CantidadPersonas; plato.Categoria = vm.Categoria; await _repository.Update(plato); } return(View(vm)); }
public PlatoPage(FoodLine plato) { InitializeComponent(); dataWCF = DependencyService.Get <IDataStore>(); viewModel = new PlatoViewModel(plato, this); viewModel.SetHeight += ViewModel_SetHeight; BindingContext = viewModel; }
public IEnumerable <IViewModel> GetViewModels() { foreach (T obj in _enumerable) { var vm = new PlatoViewModel <T>(obj); yield return(vm); } }
public async Task <ActionResult> Create(PlatoViewModel vm, PlatoIngredientes vms) { if (ModelState.IsValid) { var platoEntity = _mapper.Map <Plato>(vm); await _repository.Add(platoEntity); return(RedirectToAction("Index")); } return(View()); }