예제 #1
0
        public async Task <ServiceResponse <List <GetCharacterDto> > > PostCharacter(PostCharacterDto newCharacter)
        {
            ServiceResponse <List <GetCharacterDto> > serviceResponse = new ServiceResponse <List <GetCharacterDto> >();
            Character character = _mapper.Map <Character>(newCharacter);

            character.Id = characters.Max(c => c.Id) + 1;
            characters.Add(character);
            serviceResponse.Data = (characters.Select(c => _mapper.Map <GetCharacterDto>(c))).ToList();
            return(serviceResponse);
        }
예제 #2
0
 public async Task <IActionResult> PostCharacter(PostCharacterDto newCharacter)
 {
     return(Ok(await _characterService.PostCharacter(newCharacter)));
 }