public DepartmentReturnDto GetDepartmentById(int id) { if (!_departmentOperations.DepartmentExists(id)) { return(null); } var department = _departmentOperations.GetDepartmentById(id); return(department == null ? null : Mapper.Map <DepartmentReturnDto>(department)); }
public Tuple <UserReturnDto, LinkDto> CreateUser(NewUserDto user) { var department = _departmentOperations.GetDepartmentById(user.DepartmentId); if (department == null) { return(null); } var returnedUser = _userOperations.CreateUser(Mapper.Map <User>(user), department); return(new Tuple <UserReturnDto, LinkDto>(Mapper.Map <UserReturnDto>(returnedUser), CreateLink(returnedUser.UserID, "GetUserById", this._urlHelper))); }