Esempio n. 1
0
 public ActionResult Create(int companyId)
 {
     CompanyAddress companyaddress = new CompanyAddress();
     companyaddress.CompanyID = companyId;
     ViewBag.PossibleCompanyAddressCategories = companyaddresscategoryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     return View(companyaddress);
 }
Esempio n. 2
0
 public ActionResult Create(CompanyAddress companyaddress, int companyId)
 {
     if (ModelState.IsValid)
     {
         companyaddressRepository.InsertOrUpdate(companyaddress);
         companyaddressRepository.Save();
         return RedirectToAction("Index", new { companyId=companyId });
     }
     else
     {
         ViewBag.PossibleCompanyAddressCategories = companyaddresscategoryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         return View(companyaddress);
     }
 }
Esempio n. 3
0
 public ActionResult Edit(CompanyAddress companyAddress, int companyId)
 {
     if (ModelState.IsValid)
     {
         companyaddressRepository.InsertOrUpdate(companyAddress);
         companyaddressRepository.Save();
         return RedirectToAction("Index", new { companyId = companyId });
     }
     else
     {
         ViewBag.PossibleCompanyAddressCategories = companyaddresscategoryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         if (companyAddress.CountryID.HasValue)
         {
             ViewBag.PossibleStates = stateRepository.FindAllByCountryID(companyAddress.CountryID.Value);
         }
         return View(companyAddress);
     }
 }
Esempio n. 4
0
 public ViewResult Search(CompanyAddress searchCompanyAddress, int companyId)
 {
     if (searchCompanyAddress != null)
     {
     }
     return View("Index", companyaddressRepository.AllIncluding(companyId, companyaddress => companyaddress.Company, companyaddress => companyaddress.CompanyAddressCategory, companyaddress => companyaddress.Country, companyaddress => companyaddress.State));
 }
Esempio n. 5
0
 public void InsertOrUpdate(CompanyAddress companyaddress)
 {
     if (companyaddress.CompanyAddressID == default(int)) {
         // New entity
         context.CompanyAddress.Add(companyaddress);
     } else {
         // Existing entity
         context.Entry(companyaddress).State = EntityState.Modified;
     }
 }