示例#1
0
        public async Task <ResponseDto <bool> > AssignManager(int id, int userId)
        {
            var departmentFromDb = await _departmentsRepository.GetDepartmentById(id);

            var userFromDb = await _userRepository.GetUserById(userId);

            ResponseDto <bool> response = DepartmentsValidator.ValidateAssignManager(departmentFromDb, userFromDb);

            if (response.HasErrors)
            {
                return(response);
            }

            response.Value = await _departmentsRepository.AssignManager(id, userId);

            return(response);
        }