public async Task <IActionResult> GetMediaRating([FromQuery] MediaTierQueryDto tierQueryDto) { if (tierQueryDto.MediaId <= 0) { return(BadRequest("Media information is requried to provide the rating")); } var retunrRatingDto = new ReturnRatingDto(); retunrRatingDto.Rating = await _ratingCoordinator.GetRatingsAsync(_mapper.Map <TierQueryDto>(tierQueryDto)); if (retunrRatingDto.Rating <= 0) { retunrRatingDto.Rating = 0.0d; } retunrRatingDto.NumberOfVotes = await _ratingCoordinator.GetTotalVotesAsync(_mapper.Map <TierQueryDto>(tierQueryDto)); return(Ok(retunrRatingDto)); }
public async Task <ActionResult <ReturnRatingDto> > GetJournalistTier([FromQuery] JournalistTierQueryDto tierQueryDto) { if (tierQueryDto.JournalistId <= 0) { return(BadRequest("Journalist details are required to get the ratings.")); } var retunrRatingDto = new ReturnRatingDto(); retunrRatingDto.Rating = await _ratingCoordinator.GetRatingsAsync(_mapper.Map <TierQueryDto>(tierQueryDto)); if (retunrRatingDto.Rating <= 0) { retunrRatingDto.Rating = 0.0d; } retunrRatingDto.NumberOfVotes = await _ratingCoordinator.GetTotalVotesAsync(_mapper.Map <TierQueryDto>(tierQueryDto)); return(Ok(retunrRatingDto)); }