public async Task <ActionResult <PostRatingResponseModel> > Post(PostRatingInputModel input) { string userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.ratingService.SetRatingAsync(input.QuestionId, userId, input.Value); double averageRating = this.ratingService.GetAverageRatings(input.QuestionId); return(new PostRatingResponseModel { AverageRating = averageRating }); }
public async Task <ActionResult <PostRatingViewModel> > Post(PostRatingInputModel input) { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.ratingsService.SetRatingAsync(input.GameId, userId, input.Value); var averageRating = this.ratingsService.GetAverageRating(input.GameId); return(new PostRatingViewModel { AverageRating = averageRating }); }
public async Task <ActionResult <PostRatingResponseViewModel> > Post(PostRatingInputModel inputModel) { var userId = this.userManager.GetUserId(this.User); await this.ratingsService.SetRatingAsync(inputModel.SpecialistDetailsId, userId, inputModel.Value); var averageRaiting = await this.ratingsService.GetAverageRatingAsync(inputModel.SpecialistDetailsId); var ratingsCount = await this.ratingsService.GetRatingsCountAsync(inputModel.SpecialistDetailsId); var model = new PostRatingResponseViewModel { AverageRatings = averageRaiting, RatingsCount = ratingsCount, }; return(model); }