예제 #1
0
        // GET: VacancyMaster/Edit/5
        public ActionResult Edit(int id)
        {
            using (var unitOfWork = new UnitWork1(new EAMSContext()))
            {
                var vcyMstr = unitOfWork.VacancyMasters.Get(id);
                var config  = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <VacancyMaster, VacancyDetailsUpVM>();
                });
                IMapper            mapper    = config.CreateMapper();
                VacancyDetailsUpVM UpdateDto = mapper.Map <VacancyMaster, VacancyDetailsUpVM>(vcyMstr);

                ViewBag.Companies        = unitOfWork.CompanyMasters.GetCompanies();
                ViewBag.States           = unitOfWork.StateMasters.GetStates();
                ViewBag.Qualifications   = unitOfWork.QualificationMasters.GetQualifications();
                ViewBag.Grades           = unitOfWork.GradeMasters.GetGrades();
                ViewData["SelectedCity"] = UpdateDto.CityId;

                unitOfWork.Complete();
                return(View(UpdateDto));
            }
        }
예제 #2
0
        public ActionResult Edit(VacancyDetailsUpVM objvcyMstrUpVm)
        {
            try
            {
                using (var unitOfWork = new UnitWork1(new EAMSContext()))
                {
                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <VacancyDetailsUpVM, VacancyMaster>();
                    });
                    IMapper       mapper    = config.CreateMapper();
                    VacancyMaster UpdateDto = mapper.Map <VacancyDetailsUpVM, VacancyMaster>(objvcyMstrUpVm);

                    unitOfWork.VacancyMasters.Update(UpdateDto);
                    unitOfWork.Complete();
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }