Exemplo n.º 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);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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));
 }
Exemplo n.º 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;
     }
 }