Beispiel #1
0
        public DepartmentReturnDto GetDepartmentById(int id)
        {
            if (!_departmentOperations.DepartmentExists(id))
            {
                return(null);
            }
            var department = _departmentOperations.GetDepartmentById(id);

            return(department == null ? null : Mapper.Map <DepartmentReturnDto>(department));
        }
Beispiel #2
0
        public UserChangedReturnDto UpdateUser(int userId, UpdateUserDto userUpdate)
        {
            if (!_userOperations.UserExists(userId))
            {
                return(null);
            }
            var user = _userOperations.GetUserById(userId);

            if (!_departmentOperations.DepartmentExists(userUpdate.DepartmentId))
            {
                return(null);
            }
            var department  = _departmentOperations.GetDepartmentById(userUpdate.DepartmentId);
            var updatedUser = _userOperations.UpdateUser(user, department, userUpdate.EmailAddress);

            return(updatedUser == null ? null : Mapper.Map <UserChangedReturnDto>(updatedUser));
        }