コード例 #1
0
 public ActionResult Create(int vendorId)
 {
     VendorAddress vendoraddress = new VendorAddress();
     vendoraddress.VendorID = vendorId;
     ViewBag.PossibleVendorAddressCategories = vendoraddresscategoryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     return View(vendoraddress);
 }
コード例 #2
0
 public ActionResult Create(VendorAddress vendoraddress,int vendorId)
 {
     if (ModelState.IsValid) {
         vendoraddressRepository.InsertOrUpdate(vendoraddress);
         vendoraddressRepository.Save();
         return RedirectToAction("Index",new { vendorId=vendorId });
     } else {
         ViewBag.PossibleVendorAddressCategories = vendoraddresscategoryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         return View(vendoraddress);
     }
 }
コード例 #3
0
 public ActionResult Edit(VendorAddress vendoraddress,int vendorId)
 {
     if (ModelState.IsValid) {
         vendoraddressRepository.InsertOrUpdate(vendoraddress);
         vendoraddressRepository.Save();
         return RedirectToAction("Index",new { vendorId=vendorId });
     } else {
                 ViewBag.PossibleVendorAddressCategories = vendoraddresscategoryRepository.All;
                 ViewBag.PossibleCountries = countryRepository.All;
                 if (vendoraddress.CountryID.HasValue)
     {
         ViewBag.PossibleStates = stateRepository.FindAllByCountryID(vendoraddress.CountryID.Value);
     }
                     return View(vendoraddress);
     }
 }
コード例 #4
0
 public ViewResult Search(VendorAddress searchVendorAddress,int vendorId)
 {
     if(searchVendorAddress!=null)
     {
                     }
                 return View("Index",vendoraddressRepository.AllIncluding(vendorId,vendoraddress => vendoraddress.Vendor, vendoraddress => vendoraddress.VendorAddressCategory, vendoraddress => vendoraddress.Country, vendoraddress => vendoraddress.State));
 }
コード例 #5
0
 public void InsertOrUpdate(VendorAddress vendoraddress)
 {
     if (vendoraddress.VendorAddressID == default(int))
     {
         // New entity
         context.VendorAddress.Add(vendoraddress);
     }
     else
     {
         // Existing entity
         context.Entry(vendoraddress).State = EntityState.Modified;
     }
 }