public ActionResult AddStaff() { AddStaffModel Model = new AddStaffModel() { CreateAccount = true }; return(View(Model)); }
public ActionResult AddStaff(AddStaffModel Model) { if (ModelState.IsValid) { Staff staff = new Staff() { Fullname = Model.Name, Email = Model.Email, Phone = Model.Phone, IsActive = true }; if (Model.CreateAccount) { staff.User = AccBO.CreateUser(staff.Fullname); } StaffBO.Insert(staff); return(RedirectToAction("StaffAccountList")); } return(View(Model)); }
public int AddStaff(AddStaffModel body) { var model = _mapper.Map <AddStaffModel, Staff>(body); return(_staffService.Insert(model)); }