Beispiel #1
0
        public async Task <ActionResult <List <Character> > > GetAll([FromQuery] string house)
        {
            try
            {
                List <Character> characters = new List <Character>();
                if (!string.IsNullOrEmpty(house))
                {
                    characters = await _repository.GetAllCharactersByHouseAsync(house);
                }
                else
                {
                    characters = await _repository.GetAllCharactersAsync();
                }

                return(Ok(_mapper.Map <List <CharacterReadDto> >(characters)));
            }
            catch (Exception)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }