コード例 #1
0
        public async Task <GetMavelCharacterDTO> getCharacter(int artistId)
        {
            MavelCharacter character = await _db.MavelCharacters.AsNoTracking().FirstOrDefaultAsync(p => p.ArtistId == artistId);

            GetMavelCharacterDTO mavelCharacterDTO = _mapper.Map <GetMavelCharacterDTO>(character);

            return(mavelCharacterDTO);
        }
コード例 #2
0
        public async Task <DataRespone <GetMavelCharacterDTO> > GetCharacter(int id)
        {
            if (id == 0)
            {
                throw new MyBadRequestException(HttpStatusCode.BadRequest, "Character must be not null.");
            }

            GetMavelCharacterDTO character = await _characterService.getCharacter(id);

            if (character == null)
            {
                throw new MyNotFoundException(HttpStatusCode.NotFound, "Character have not found.");
            }

            return(new DataRespone <GetMavelCharacterDTO>()
            {
                Ok = true, data = character, error = ""
            });
        }