public ActionResult Create() { ContactFolderContact contactfoldercontact = new ContactFolderContact(); ViewBag.PossibleContactFolders = contactfolderRepository.All; ViewBag.PossibleCompanies = companyRepository.All; ViewBag.PossibleContacts = contactRepository.All; return View(contactfoldercontact); }
public ActionResult Create(ContactFolderContact contactfoldercontact) { if (ModelState.IsValid) { contactfoldercontactRepository.InsertOrUpdate(contactfoldercontact); contactfoldercontactRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossibleContactFolders = contactfolderRepository.All; ViewBag.PossibleCompanies = companyRepository.All; ViewBag.PossibleContacts = contactRepository.All; return View(contactfoldercontact); } }
public ViewResult Search(ContactFolderContact searchContactFolderContact) { if(searchContactFolderContact!=null) { } return View("Index",contactfoldercontactRepository.AllIncluding(contactfoldercontact => contactfoldercontact.ContactFolder, contactfoldercontact => contactfoldercontact.Company, contactfoldercontact => contactfoldercontact.Contact)); }
public void InsertOrUpdate(ContactFolderContact contactfoldercontact) { if (contactfoldercontact.ContactFolderContactID == default(int)) { // New entity context.ContactFolderContact.Add(contactfoldercontact); } else { // Existing entity context.Entry(contactfoldercontact).State = EntityState.Modified; } }