// GET: RankMaster/Edit/5 public ActionResult Edit(int id) { using (var unitOfWork = new UnitWork1(new EAMSContext())) { var rankMstr = unitOfWork.RankMasters.Get(id); var config = new MapperConfiguration(cfg => { cfg.CreateMap <RankMasterVM, RankMaster>(); }); IMapper mapper = config.CreateMapper(); RankMasterVM UpdateDto = mapper.Map <RankMaster, RankMasterVM>(rankMstr); unitOfWork.Complete(); return(View(UpdateDto)); } }
public ActionResult Edit(RankMasterVM objrnkMstrVm) { try { using (var unitOfWork = new UnitWork1(new EAMSContext())) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <RankMasterVM, RankMaster>(); }); IMapper mapper = config.CreateMapper(); RankMaster UpdateDto = mapper.Map <RankMasterVM, RankMaster>(objrnkMstrVm); unitOfWork.RankMasters.Update(UpdateDto); unitOfWork.Complete(); return(RedirectToAction("Index")); } } finally { } }