// PUT api/Todo/5 public HttpResponseMessage PutTodoItem(int id, TodoItem todoitem) { if (ModelState.IsValid && id == todoitem.TodoItemId) { db.Entry(todoitem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public IActionResult Edit(Item item) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Edit(Category category) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }