コード例 #1
0
        public async Task <IActionResult> GetBestPractices(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 <BestPractice> bestPracticesFromRepo = await _repo.GetBestPractices(userId, department, objective, step);

            IEnumerable <BestPracticeForReturnDto> bestPracticeForReturn = _mapper.Map <IEnumerable <BestPracticeForReturnDto> >(bestPracticesFromRepo);

            return(Ok(bestPracticeForReturn));
        }