Exemple #1
0
 // GET: CityMaster/Edit/5
 //[EncryptedActionParameter]
 public ActionResult Edit(int id)
 {
     using (var unitOfWork = new UnitWork1(new EAMSContext()))
     {
         var cityMstr = unitOfWork.CityMasters.Get(id);
         var config   = new MapperConfiguration(cfg =>
         {
             cfg.CreateMap <CityMaster, CityMasterVM>();
         });
         IMapper      mapper    = config.CreateMapper();
         CityMasterVM UpdateDto = mapper.Map <CityMaster, CityMasterVM>(cityMstr);
         ViewBag.States = unitOfWork.StateMasters.GetStates();
         unitOfWork.Complete();
         return(View(UpdateDto));
     }
 }
Exemple #2
0
 public ActionResult Edit(CityMasterVM objCityMstrVm)
 {
     try
     {
         using (var unitOfWork = new UnitWork1(new EAMSContext()))
         {
             var config = new MapperConfiguration(cfg =>
             {
                 cfg.CreateMap <CityMasterVM, CityMaster>();
             });
             IMapper    mapper    = config.CreateMapper();
             CityMaster UpdateDto = mapper.Map <CityMasterVM, CityMaster>(objCityMstrVm);
             unitOfWork.CityMasters.Update(UpdateDto);
             unitOfWork.Complete();
             return(RedirectToAction("Index"));
         }
     }
     finally { }
 }