Esempio n. 1
0
 public void EditPartial(AuthorInsertDTO authorInsertDTO, Author author)
 {
     Mapper.Map(authorInsertDTO, author);
     if (!_authorRepository.Save())
     {
         throw new InternalServerErrorException();
     }
 }
Esempio n. 2
0
 public IActionResult addAuthor([FromBody] AuthorInsertDTO authorDTO)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _authorService.Add(authorDTO);
     return(Ok());
 }
Esempio n. 3
0
        public void Edit(int id, AuthorInsertDTO authorInsertDTO)
        {
            Author author = GetAuthor(id);

            Mapper.Map(authorInsertDTO, author);
            if (!_authorRepository.Save())
            {
                throw new InternalServerErrorException();
            }
        }
Esempio n. 4
0
        public void Add(AuthorInsertDTO authorInsertDTO)
        {
            Author author = Mapper.Map <Author>(authorInsertDTO);

            if (author == null)
            {
                throw new NotFoundException();
            }
            if (!_authorRepository.AddSaveChanges(author))
            {
                throw new InternalServerErrorException();
            }
        }
Esempio n. 5
0
 public IActionResult editAuthor(int id, [FromBody] AuthorInsertDTO authorDTO)
 {
     _authorService.Edit(id, authorDTO);
     return(NoContent());
 }