示例#1
0
        public async Task <IActionResult> SetRate(SetRateViewModel setRateViewModel)
        {
            var model = _mapper.Map <SetRateViewModel, SetRateModel>(setRateViewModel);
            await _booksClient.SetRate(model);

            return(RedirectToAction("Search"));
        }
示例#2
0
        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));
        }