示例#1
0
        public async Task <IActionResult> GetJednostkiUser(int userId)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var jednostkiFromRepo = await _repo.GetJednostkiUser(userId);

            if (jednostkiFromRepo == null)
            {
                return(NotFound());
            }

            var jednostkiForReturn = _mapper.Map <IEnumerable <JednostkaForTreeDto> >(jednostkiFromRepo);

            return(Ok(jednostkiForReturn));
        }