public ActionResult Create(Contact contact) { try { if (!ModelState.IsValid) return View(contact); repo.Add(contact); repo.Save(); return RedirectToAction("Index"); } catch (Exception ex) { Util.Log(ex); } return View("Error"); }
public void Remove(Contact entity) { this.db.Contacts.Remove(entity); }
public void Add(Contact entity) { this.db.Contacts.Add(entity); }
public ActionResult Edit(int id, Contact contact) { try { var record = repo.Single(id); UpdateModel<Contact>(record); if (!ModelState.IsValid) return View(record); repo.Save(); return RedirectToAction("Index"); } catch (Exception ex) { Util.Log(ex); } return View("Error"); }