public async Task <IActionResult> CreateRate(long ID, string text, bool anonymous, int score)
        {
            try
            {
                var token = HttpContext.User.FindFirst(ClaimTypes.Hash).Value;

                var rateRequest = new CreateRateRequest()
                {
                    Anonymous = anonymous,
                    MovieID   = ID,
                    Score     = score,
                    Text      = text
                };

                await rateFacade.CreateRateAsync(token, rateRequest);

                return(RedirectToAction(nameof(Detail), new { ID, page = 1 }));
            }
            catch (ApiException)
            {
                // Catched on api side
                return(RedirectToAction(nameof(Detail), new { ID, page = 1 }));
            }
        }
示例#2
0
 public async Task CreateRate(CreateRateRequest rateRequest)
 {
     await _rateFacade.CreateRateAsync(HttpContext.User.FindFirst(ClaimTypes.Hash).Value, rateRequest);
 }