Cleaned code
This commit is contained in:
@@ -22,9 +22,8 @@ public class CreateBookEndpoint(BookRepository bookRepository, AuthorRepository
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
await bookRepository.AddAsync(mapper.Map<Book>(req), ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class GetBooksEndpoint(BookRepository bookRepository) : EndpointWithoutRe
|
||||
Get("/books/");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
await Send.OkAsync(await bookRepository.ProjectToListAsync<GetBookDto>(ct), ct);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UpdateBookEndpoit(BookRepository bookRepository, AutoMapper.IMapper
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mapper.Map(req, book);
|
||||
await bookRepository.SaveChangesAsync(ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
|
||||
Reference in New Issue
Block a user