public JsonResult Edit2(ToDoList model) { if (ModelState.IsValid) { ToDoList todolist = db.ToDoLists.Find(model.ToDoListId); //ToDoList = db.Entry.Where(c => c.Id == model.ToDoListId).FirstOrDefault(); todolist.NameOfDuty = model.NameOfDuty; todolist.Date = model.Date; todolist.DateToFinish = model.DateToFinish; return(Json(JsonFactory.SuccessResponse(todolist), JsonRequestBehavior.DenyGet)); } else { return(Json(JsonFactory.ErrorResponse("Please review your form"), JsonRequestBehavior.DenyGet)); } }