public Categoria Put([FromBody] Categoria cat) { _context.Entry <Categoria>(cat).State = EntityState.Modified; _context.SaveChanges(); return(cat); }
public async Task <IActionResult> PutCat(Guid id, Cat cat) { if (id != cat.Id) { return(BadRequest()); } _context.Entry(cat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,Name")] Breed breed) { if (ModelState.IsValid) { db.Entry(breed).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(breed)); }
public ActionResult Edit([Bind(Include = "Id,Name,BreedId")] Cat cat) { if (ModelState.IsValid) { db.Entry(cat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BreedId = new SelectList(db.Breeds, "Id", "Name", cat.BreedId); return(View(cat)); }
public void Update(Produto p) { _context.Entry <Produto>(p).State = EntityState.Modified; _context.SaveChanges(); }