public ActionResult DeleteConfirmed(int id = 0) { myContact _mycontact = _db.myContacts.Find(id); _db.myContacts.Remove(_mycontact); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(myContact _mycontact) { if (ModelState.IsValid) { _db.Entry(_mycontact).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(_mycontact)); }
public ActionResult Create(myContact _mycontact) { if (ModelState.IsValid) { _db.myContacts.Add(_mycontact); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(_mycontact)); }
public ActionResult Delete(int id = 0) { myContact _mycontact = _db.myContacts.Find(id); if (_mycontact == null) { return(HttpNotFound()); } return(View(_mycontact)); }