public ActionResult Create(int vendorId) { VendorContact vendorcontact = new VendorContact(); vendorcontact.VendorID = vendorId; ViewBag.PossibleCountries = countryRepository.All; ViewBag.PossibleContactProfessionTypes = contactprofessiontypeRepository.All; ViewBag.PossibleEthnicBackgrounds = ethnicbackgroundRepository.All; ViewBag.PossibleGenders = genderRepository.All; ViewBag.PossibleVeteranCategories = veterancategoryRepository.All; ViewBag.PossibleBirthCountries = countryRepository.All; return View(vendorcontact); }
public ActionResult Create(VendorContact vendorcontact,int vendorId) { if (ModelState.IsValid) { vendorcontactRepository.InsertOrUpdate(vendorcontact); vendorcontactRepository.Save(); return RedirectToAction("Index",new { vendorId=vendorId }); } else { ViewBag.PossibleCountries = countryRepository.All; ViewBag.PossibleContactProfessionTypes = contactprofessiontypeRepository.All; ViewBag.PossibleEthnicBackgrounds = ethnicbackgroundRepository.All; ViewBag.PossibleGenders = genderRepository.All; ViewBag.PossibleVeteranCategories = veterancategoryRepository.All; ViewBag.PossibleBirthCountries = countryRepository.All; return View(vendorcontact); } }
public ViewResult Search(VendorContact searchVendorContact,int vendorId) { if(searchVendorContact!=null) { } return View("Index",vendorcontactRepository.AllIncluding(vendorId,vendorcontact => vendorcontact.Vendor, vendorcontact => vendorcontact.Country, vendorcontact => vendorcontact.State, vendorcontact => vendorcontact.ContactProfessionType, vendorcontact => vendorcontact.EthnicBackground, vendorcontact => vendorcontact.Gender, vendorcontact => vendorcontact.VeteranCategory, vendorcontact => vendorcontact.BirthCountry, vendorcontact => vendorcontact.CreatedByUser, vendorcontact => vendorcontact.VerifiedByUser)); }
public void InsertOrUpdate(VendorContact vendorcontact) { if (vendorcontact.VendorContactID == default(int)) { // New entity context.VendorContact.Add(vendorcontact); } else { // Existing entity context.Entry(vendorcontact).State = EntityState.Modified; } }