public ActionResult Put(int id, [FromBody] Consumo entity) { repository.Update(entity); return(Ok(new { status = "200", msg = "OK", obj = entity })); }
public IActionResult Edit(Guid id, ConsumoViewModel consumoViewModel) { if (id != consumoViewModel.Id) { return(NotFound()); } if (ModelState.IsValid) { var consumo = _mapper.Map <Consumo>(consumoViewModel); _consumoRepository.Update(consumo); _uow.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(consumoViewModel)); }
public ActionResult Put(int id, [FromBody] Consumo entity) { var restaurante = restauranteRepository.GetByID(entity.id); if (restaurante != null) { entity.restaurante = restaurante; } repository.Update(entity); return(Ok(new { status = "200", msg = "OK", obj = entity })); }
public RedirectToActionResult Update(Consumo entity) { entity.restaurante = restauranteRepository.GetByID(entity.restaurante.id); consumoRepository.Update(entity); return(RedirectToAction("Index")); }
public RedirectToActionResult Update(Consumo entity) { consumoRepository.Update(entity); return(RedirectToAction("Index")); }