fix error with sending responses
This commit is contained in:
@@ -16,6 +16,6 @@ public class CreateAuthorEndpoint(AuthorRepository authorRepository, AutoMapper.
|
||||
public override async Task HandleAsync(CreateAuthorDto req, CancellationToken ct)
|
||||
{
|
||||
await authorRepository.AddAsync(mapper.Map<Author>(req), ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,6 @@ public class DeleteAuthorEndpoint(AuthorRepository authorRepository) : Endpoint<
|
||||
}
|
||||
|
||||
await authorRepository.DeleteAsync(author, ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,6 @@ public class UpdateAuthorEndpoint(AuthorRepository authorRepository, AutoMapper.
|
||||
|
||||
mapper.Map(req, author);
|
||||
await authorRepository.SaveChangesAsync(ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class CreateBookEndpoint(BookRepository bookRepository, AuthorRepository
|
||||
}
|
||||
|
||||
await bookRepository.AddAsync(mapper.Map<Book>(req), ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,6 @@ public class DeleteBookEndpoint(BookRepository bookRepository, LoanRepository lo
|
||||
}
|
||||
|
||||
await bookRepository.DeleteAsync(book, ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,6 @@ public class UpdateBookEndpoit(BookRepository bookRepository, AutoMapper.IMapper
|
||||
|
||||
mapper.Map(req, book);
|
||||
await bookRepository.SaveChangesAsync(ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,6 @@ public class CreateLoanEndpoint(LoanRepository loanRepository, BookRepository bo
|
||||
}
|
||||
|
||||
await loanRepository.AddAsync(mapper.Map<Loan>(req), ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,11 @@ public class PatchReturnLoanEndpoint(LoanRepository loanRepository) : Endpoint<P
|
||||
if (loan is null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
return;
|
||||
}
|
||||
|
||||
loan?.ReturnDate = req.ReturnDate;
|
||||
await loanRepository.SaveChangesAsync(ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,6 @@ public class CreateMemberEndpoint(MemberRepository memberRepository, AutoMapper.
|
||||
public override async Task HandleAsync(CreateMemberDto req, CancellationToken ct)
|
||||
{
|
||||
await memberRepository.AddAsync(mapper.Map<Member>(req), ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,6 @@ public class UpdateMemberEndpoint(MemberRepository memberRepository, AutoMapper.
|
||||
|
||||
mapper.Map(req, member);
|
||||
await memberRepository.SaveChangesAsync(ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,6 @@ public class CreateReviewEndpoint(
|
||||
}
|
||||
|
||||
await reviewRepository.AddAsync(mapper.Map<Review>(req), ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,6 @@ public class DeleteReviewEndpoint(ReviewRepository reviewRepository) : Endpoint<
|
||||
}
|
||||
|
||||
await reviewRepository.DeleteAsync(review, ct);
|
||||
await Send.OkAsync(cancellation: ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user