public void CreateStaff(SaveStaffDto saveStaffDto) { var Staff = _mapper.Map <SaveStaffDto, Staff>(saveStaffDto); _unitOfWork.Staffs.Add(Staff); _unitOfWork.Complete(); }
public IActionResult OnGet(int?id) { var t = Request.Cookies["logon"]; if (t == null) { return(RedirectToPage("../Accounts/Login")); } if (t == "false") { return(RedirectToPage("../Accounts/Login")); } if (id == null) { return(NotFound()); } var pStaff = _service.GetStaff(id ?? default(int)); if (pStaff == null) { return(NotFound()); } Staff = _mapper.Map <StaffDto, SaveStaffDto>(pStaff); return(Page()); }
public void UpdateStaff(SaveStaffDto saveStaffDto) { var Staff = _unitOfWork.Staffs.GetBy(saveStaffDto.id); if (Staff == null) { return; } _mapper.Map <SaveStaffDto, Staff>(saveStaffDto, Staff); _unitOfWork.Complete(); }