Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 3
0
 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");
 }
Exemplo n.º 4
0
 partial void DeleteContact(Contact instance);
Exemplo n.º 5
0
 partial void UpdateContact(Contact instance);
Exemplo n.º 6
0
 partial void InsertContact(Contact instance);
Exemplo n.º 7
0
		private void detach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Department = null;
		}
Exemplo n.º 8
0
		private void attach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Department = this;
		}