public ActionResult Create(RegEAMSJcoCreate objEAMSJcoCr) { try { using (var unitOfWork = new UnitWork1(new EAMSContext())) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <RegEAMSJcoCreate, RegistrationEAMSJco>(); }); IMapper mapper = config.CreateMapper(); RegistrationEAMSJco CreateDto = mapper.Map <RegEAMSJcoCreate, RegistrationEAMSJco>(objEAMSJcoCr); unitOfWork.RegEAMSJCOs.Add(CreateDto); ViewData["SelectedCityC"] = objEAMSJcoCr.CCityId; ViewData["SelectedCityP"] = objEAMSJcoCr.PCityId; ViewData["SelectedRankID"] = objEAMSJcoCr.Ranks; unitOfWork.Complete(); return(RedirectToAction("Index")); } } catch { return(View()); } }
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()); } }