Exemplo n.º 1
0
        public async Task <IActionResult> GetCommonDifficulties(int userId, string department, string objective, string step)
        {
            var creator = await _userRepo.GetUser(userId);

            if (creator.Id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            IEnumerable <CommonDifficulty> commonDifficultysFromRepo = await _repo.GetCommonDifficulties(userId, department, objective, step);

            IEnumerable <CommonDifficultyForReturnDto> commonDifficultyForReturn = _mapper.Map <IEnumerable <CommonDifficultyForReturnDto> >(commonDifficultysFromRepo);

            return(Ok(commonDifficultyForReturn));
        }