public ActionResult Create(int vendorId)
 {
     VendorInsurance vendorinsurance = new VendorInsurance();
     vendorinsurance.VendorID = vendorId;
     ViewBag.PossibleVendorInsuranceCategories = vendorinsurancecategoryRepository.All;
     return View(vendorinsurance);
 }
 public ActionResult Create(VendorInsurance vendorinsurance,int vendorId)
 {
     if (ModelState.IsValid) {
         vendorinsuranceRepository.InsertOrUpdate(vendorinsurance);
         vendorinsuranceRepository.Save();
         return RedirectToAction("Index",new { vendorId=vendorId });
     } else {
         ViewBag.PossibleVendorInsuranceCategories = vendorinsurancecategoryRepository.All;
         return View(vendorinsurance);
     }
 }
 public ViewResult Search(VendorInsurance searchVendorInsurance,int vendorId)
 {
     if(searchVendorInsurance!=null)
     {
                     }
                 return View("Index",vendorinsuranceRepository.AllIncluding(vendorId,vendorinsurance => vendorinsurance.Vendor, vendorinsurance => vendorinsurance.VendorInsuranceCategory));
 }
 public void InsertOrUpdate(VendorInsurance vendorinsurance)
 {
     if (vendorinsurance.VendorInsuranceID == default(int)) {
         // New entity
         context.VendorInsurance.Add(vendorinsurance);
     } else {
         // Existing entity
         context.Entry(vendorinsurance).State = EntityState.Modified;
     }
 }