public IHttpActionResult Delete(int contactId) { var contactDelete = contactsDBEntities.tblContacts.Where(x => x.ContactId == contactId).FirstOrDefault(); contactsDBEntities.Entry(contactDelete).State = System.Data.Entity.EntityState.Deleted; contactsDBEntities.SaveChanges(); return(Ok()); }
public ActionResult Edit(int id, Employee employee) { try { // TODO: Add update logic here using (ContactsDBEntities db = new ContactsDBEntities()) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public Contact UpdateContact(Contact _contact) { DBContext.Entry(_contact).State = System.Data.EntityState.Modified; DBContext.SaveChanges(); return(_contact); }
public bool Update(T entity) { _contactsDBEntities.Entry <T>(entity).State = EntityState.Modified; _contactsDBEntities.SaveChanges(); return(true); }