public virtual async Task <IActionResult> OnPostAsync() { var dto = ObjectMapper.Map <CreateEditBookViewModel, CreateUpdateBookDto>(ViewModel); await _service.UpdateAsync(Id, dto); return(NoContent()); }
public async Task UpdateAsync() { // Arrange var input = new BookUpdateDto() { Name = "0a0141e1329e48adbd91f1d21a567a142517734d1cc3420b9464df6a3e5d84020d6a1171f2654a7a91c29de099ca4d312fce" }; // Act var serviceResult = await _bookAppService.UpdateAsync(Guid.Parse("682c0b6a-1d72-4094-b180-cea1dab40ed5"), input); // Assert var result = await _bookRepository.FindAsync(c => c.Id == serviceResult.Id); result.ShouldNotBe(null); result.Name.ShouldBe("0a0141e1329e48adbd91f1d21a567a142517734d1cc3420b9464df6a3e5d84020d6a1171f2654a7a91c29de099ca4d312fce"); }
public async Task <IActionResult> Put([FromBody] BookViewModel bookViewModel) { try { if (!ModelState.IsValid) { return(BadRequest()); } var bookViewModelResult = await _bookAppService.UpdateAsync(bookViewModel); if (bookViewModelResult?.Data == null) { return(BadRequest(new { message = "A problem occurred during updating the data." })); } return(Ok(bookViewModelResult.Data)); } catch (ExceptionHandler exceptionHandler) { return(ResponseByHttpStatusCode(exceptionHandler)); } }
public async Task <IActionResult> OnPostAsync() { await _bookAppService.UpdateAsync(Id, Book); return(NoContent()); }
public async Task <BookDto> UpdateAsync(Guid id, CreateUpdateBookDto input) { return(await _bookAppService.UpdateAsync(id, input)); }
public virtual Task <BookDto> UpdateAsync(Guid id, BookUpdateDto input) { return(_bookAppService.UpdateAsync(id, input)); }
public Task <BookDto> UpdateAsync(Guid id, CreateUpdateBookDto input) { return(_service.UpdateAsync(id, input)); }