public async Task <IActionResult> Edit(int id, [Bind("Preco,Ativo,Id,Nome")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _productApp.Update(product); } catch (DbUpdateConcurrencyException) { if (!await ProductExists(product.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <ActionResult> UpdateProduct(Guid id, ProductViewModel productViewModel) { if (!IsModelValid()) { return(CustomResponse(productViewModel)); } await _productApp.Update(id, _mapper.Map <Product>(productViewModel)); return(CustomResponse()); }
public IActionResult Update(Product entity) { return(new ObjectResult(_service.Update(entity))); }
public async Task <Product> Update(UpdateProduct model) { return(await productApp.Update(model)); }