public IActionResult GetAllClubs()
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var clubs = _clubRepository.GetAllClubs();

            return(Ok(clubs));
        }
Example #2
0
        public async Task <PagedClubsDTO> GetAllClubs(
            int pageNumber,
            int pageSize,
            string userId,
            ClubFilterData filterData)
        {
            IEnumerable <Club> clubs;

            clubs = await _clubRepository.GetAllClubs(userId);

            var result = GetClubs(pageNumber, pageSize, clubs, filterData);

            return(result);
        }
Example #3
0
        public async Task <ActionResult <ClubResponse> > GetAllClubs()
        {
            try
            {
                var clubs = await _repository.GetAllClubs();

                var clubsResponse = new List <ClubResponse>();

                foreach (var c in clubs)
                {
                    var clubResponse = _mapper.Map <ClubResponse>(c);
                    clubsResponse.Add(clubResponse);
                }

                _logger.LogInformation($"Clubs have been downloaded.");
                return(Ok(clubsResponse));
            }
            catch (System.Exception ext)
            {
                _logger.LogError(ext, "Failed to download clubs list.");
                // TODO return error object with proper error code.
                return(BadRequest());
            }
        }
Example #4
0
 public IActionResult GetAllClubs() => Ok(_clubRepository.GetAllClubs());
Example #5
0
 public List <Organization> RetrieveAllClubs()
 {
     return(_clubRepository.GetAllClubs());
 }