public async Task <IActionResult> PutCategoriesDetails([FromRoute] int id, [FromBody] CategoriesDetails categoriesDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != categoriesDetails.id) { return(BadRequest()); } _context.Entry(categoriesDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriesDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ProductId,ProductName,Description,Quantity,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public async Task <ActionResult> Edit([Bind(Include = "CatID,Categoria")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(category)); }