public HttpResponseMessage PutChecklistAPI(Checklist checklist) { if (checklist == null) { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } _context.Entry(checklist).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ChecklistExists(checklist.Id)) { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } else { throw; } } return(new HttpResponseMessage(HttpStatusCode.OK)); }
public void Update(T entity) { if (entity is null) { throw new ArgumentNullException(nameof(entity)); } _dbset.Attach(entity); _checklistContext.Entry(entity).State = EntityState.Modified; }
public ActionResult Edit([Bind(Include = "ID,Questions")] Pet pet) { if (ModelState.IsValid) { db.Entry(pet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pet)); }