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); } }
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)); }