public async Task <ActionResult> Edit(int id) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} Customer customer = await customerRepository.FindCustomerByIDAsync(id); if (customer == null) { return(HttpNotFound()); } ViewBag.CountryID = new SelectList(localizationRepository.Countries(), "CountryID", "CountryName", customer.CountryID); ViewBag.StateID = new SelectList(localizationRepository.States(customer.CountryID), "StateID", "StateName", customer.StateID); return(View(customer)); }
public async Task <ActionResult> Edit(int id) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} Contractor contractor = await contractorRepository.FindContractorsByIDAsync(id); if (contractor == null) { return(HttpNotFound()); } ViewBag.BusinessTypeID = new SelectList(businessTypeRepository.BusinessTypes(base.CurrentCustomerID), "BusinessTypeID", "BusinessTypeCode", contractor.BusinessTypeID); ViewBag.CountryID = new SelectList(localizationRepository.Countries(), "CountryID", "CountryName", contractor.CountryID); ViewBag.StateID = new SelectList(localizationRepository.States(contractor.CountryID), "StateID", "StateName", contractor.StateID); return(View(contractor)); }