public ActionResult AddContact(Contact contact) { DBNLDataContext db = new DBNLDataContext(); db.Contacts.InsertOnSubmit(contact); db.SubmitChanges(); return RedirectToAction("ListContacts"); }
public ActionResult Create(Contact contact) { try { // TODO: Add insert logic here ContactService.Add(contact.Name, contact.Email, contact.Status); return RedirectToAction("List"); } catch { return View(); } }
public ActionResult EditContact(int id, Contact contact) { DBNLDataContext db = new DBNLDataContext(); Contact updContact = db.Contacts.Where(p => p.Id == id).SingleOrDefault(); updContact.Name = contact.Name; updContact.Email = contact.Email; updContact.Status = contact.Status; db.SubmitChanges(); return RedirectToAction("ListContacts"); }
partial void DeleteContact(Contact instance);
partial void UpdateContact(Contact instance);
partial void InsertContact(Contact instance);
private void detach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.Department = null; }
private void attach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.Department = this; }