// GET: RegistrationEAMSJcosDetail/Edit/5 public ActionResult Edit(int id) { using (var unitOfWork = new UnitWork1(new EAMSContext())) { var JCOEAMS = unitOfWork.RegEAMSJCOs.Get(id); unitOfWork.Complete(); var config = new MapperConfiguration(cfg => { cfg.CreateMap <RegistrationEAMSJco, RegEAMSJcoUpdate>(); }); IMapper mapper = config.CreateMapper(); RegEAMSJcoUpdate UpdateDto = mapper.Map <RegistrationEAMSJco, RegEAMSJcoUpdate>(JCOEAMS); ViewBag.Companies = unitOfWork.CompanyMasters.GetCompanies(); ViewBag.States = unitOfWork.StateMasters.GetStates(); ViewData["SelectedCityC"] = JCOEAMS.CCityId; ViewData["SelectedCityP"] = JCOEAMS.PCityId; return(View(UpdateDto)); } }
public ActionResult Edit(RegEAMSJcoUpdate objEAMSJCOUp) { try { using (var unitOfWork = new UnitWork1(new EAMSContext())) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <RegEAMSJcoUpdate, RegistrationEAMSJco>(); }); IMapper mapper = config.CreateMapper(); RegistrationEAMSJco UpdateDto = mapper.Map <RegEAMSJcoUpdate, RegistrationEAMSJco>(objEAMSJCOUp); unitOfWork.RegEAMSJCOs.Update(UpdateDto); unitOfWork.Complete(); return(RedirectToAction("Index")); } } catch { return(View()); } }