Example #1
0
        public void UpdateProfileByAdmin(UpdateEmpProfileByAdminViewModel profile)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <UpdateEmpProfileByAdminViewModel, Employee>();
                cfg.IgnoreUnmapped();
            });
            IMapper mapper = config.CreateMapper();

            Employee employee = mapper.Map <UpdateEmpProfileByAdminViewModel, Employee>(profile);

            er.UpdateProfileByAdmin(employee);
        }
Example #2
0
        public ActionResult AdminEditEmployee(UpdateEmpProfileByAdminViewModel profile)
        {
            if (ModelState.IsValid)
            {
                profile.DepartmentID  = Convert.ToInt32(profile.DepartmentStringId);
                profile.DesignationID = Convert.ToInt32(profile.DesignationStringId);

                employeeService.UpdateProfileByAdmin(profile);

                return(RedirectToAction("employee"));
            }
            else
            {
                ModelState.AddModelError("profile", "Updation fail");
                return(RedirectToAction("employee"));
            }
        }