/// <summary> /// Gets a page of the latest comments for a video. /// </summary> public async Task <VideoComments> GetVideoComments(GetVideoComments getComments) { PreparedStatement prepared; BoundStatement bound; if (getComments.FirstCommentIdOnPage.HasValue) { prepared = await _statementCache.NoContext.GetOrAddAsync( "SELECT commentid, userid, comment, dateOf(commentid) AS comment_timestamp FROM comments_by_video WHERE videoid = ? AND commentid <= ? LIMIT ?"); bound = prepared.Bind(getComments.VideoId, getComments.FirstCommentIdOnPage.Value, getComments.PageSize); } else { prepared = await _statementCache.NoContext.GetOrAddAsync( "SELECT commentid, userid, comment, dateOf(commentid) AS comment_timestamp FROM comments_by_video WHERE videoid = ? LIMIT ?"); bound = prepared.Bind(getComments.VideoId, getComments.PageSize); } RowSet rows = await _session.ExecuteAsync(bound).ConfigureAwait(false); return(new VideoComments { VideoId = getComments.VideoId, Comments = rows.Select(MapRowToVideoComment).ToList() }); }
public string GetUserVideoComments(int VikdeoIDF) { if (SecureAuthentication != null) { int Output = CheckLoginReturnUserId(SecureAuthentication).ValueFromSQL; if (Output > 0) { GetVideoComments proc = new GetVideoComments(); return("{\"UserVideoComments\" : " + Serialize(proc.GetUserVideoComments(VikdeoIDF)) + "}"); } else { return(Serialize(new AuthResponse(0, Output == -1 ? "Authentication is NULL" : "Invalid Authentication"))); } } return(Serialize(new AuthResponse(0, "Authentication information not provided."))); }