public ActionResult UpdateContact(Contact entity) { try { ContactsDB.Entry(entity).State = System.Data.Entity.EntityState.Modified; ContactsDB.SaveChanges(); return new HttpStatusCodeResult(HttpStatusCode.Accepted); } catch { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } }
public ActionResult AddContact(Contact entity) { try { ContactsDB.Contacts.Add(entity); ContactsDB.SaveChanges(); return new HttpStatusCodeResult(HttpStatusCode.Created); } catch { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } }