예제 #1
0
        private async Task DeleteCommentRatings(string id)
        {
            IEnumerable <CommentRatingDTO> ratings = _commentRatingService.GetCommentRatings(id);

            if (ratings == null)
            {
                return;
            }
            foreach (var rating in ratings)
            {
                await _commentRatingService.Delete(rating.Id);
            }
        }
예제 #2
0
 public async Task <IActionResult> GetCommentRatings([Required] string id)
 {
     if (ModelState.IsValid)
     {
         IEnumerable <CommentRatingDTO> ratings = _commentRatingService.GetCommentRatings(id);
         if (ratings == null)
         {
             return(Ok(new List <CommentRatingModel>()));
         }
         return(Ok(await GetCommentRatingModelsFromDTOs(ratings.ToList())));
     }
     return(BadRequest(ModelState));
 }