예제 #1
0
        public ActionResult EditStaff(AddEditStaffViewModel editStaff)
        {
            if (ModelState.IsValid)
            {
                var staff   = Mapper.Map <AddEditStaffViewModel, Staff>(editStaff);
                var updated = _staffRepository.Update(staff);

                if (updated)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(editStaff));
        }
예제 #2
0
        public ActionResult AddStaff(AddEditStaffViewModel staffRequest)
        {
            if (ModelState.IsValid)
            {
                var staff   = Mapper.Map <AddEditStaffViewModel, Staff>(staffRequest);
                var created = _staffRepository.Create(staff);

                if (created)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(staffRequest));
        }