public void EditPartial(AuthorInsertDTO authorInsertDTO, Author author) { Mapper.Map(authorInsertDTO, author); if (!_authorRepository.Save()) { throw new InternalServerErrorException(); } }
public IActionResult addAuthor([FromBody] AuthorInsertDTO authorDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _authorService.Add(authorDTO); return(Ok()); }
public void Edit(int id, AuthorInsertDTO authorInsertDTO) { Author author = GetAuthor(id); Mapper.Map(authorInsertDTO, author); if (!_authorRepository.Save()) { throw new InternalServerErrorException(); } }
public void Add(AuthorInsertDTO authorInsertDTO) { Author author = Mapper.Map <Author>(authorInsertDTO); if (author == null) { throw new NotFoundException(); } if (!_authorRepository.AddSaveChanges(author)) { throw new InternalServerErrorException(); } }
public IActionResult editAuthor(int id, [FromBody] AuthorInsertDTO authorDTO) { _authorService.Edit(id, authorDTO); return(NoContent()); }