public async Task <IActionResult> SetRate(SetRateViewModel setRateViewModel) { var model = _mapper.Map <SetRateViewModel, SetRateModel>(setRateViewModel); await _booksClient.SetRate(model); return(RedirectToAction("Search")); }
public async Task <IActionResult> SetRate(SetRateViewModel setRateViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var command = new SetBookRateCommand { UserId = setRateViewModel.UserId, BookId = setRateViewModel.BookId, Rate = setRateViewModel.Rate }; var result = await _mediator.Send(command); return(Ok(result)); }