public async Task PostComment(int mediaId, string extension, CommentRequest commentRequest)
 {
     UserInfo user = await GetUserInfoAsync();
     HttpStatusCode result = await UserMediaOperations.AddMediaCommentAsync(
         DbContext, user.UserInfoId, mediaId, commentRequest);
     result.ThrowHttpResponseExceptionIfNotSuccessful();
 }
        public static async Task<HttpStatusCode> AddTimelineEntryCommentAsync(
            ApplicationDbContext dbContext,
            string userId,
            int entryId,
            CommentRequest comment)
        {
            TimelineEntry entryEntity = await dbContext.TimelineEntries
                .SingleOrDefaultAsync(te => te.TimelineEntryId == entryId);
            if (entryEntity == null)
            {
                // The entry id is part of the URL, so return a 404.
                return HttpStatusCode.NotFound;
            }

            return await CommentOperations.AddCommentAsync(
                dbContext,
                userId,
                new CommentItemIds {  TimelineEntryId = entryId },
                e => e.CommentThread,
                entryEntity,
                comment);
        }
 public async Task PostComment(int entryId, CommentRequest commentRequest)
 {
     HttpStatusCode result = await TimelineOperations.AddTimelineEntryCommentAsync(
         DbContext, UserId, entryId, commentRequest);
     result.ThrowHttpResponseExceptionIfNotSuccessful();
 }
Exemple #4
0
        public static async Task<HttpStatusCode> AddAlbumCommentAsync(
            ApplicationDbContext dbContext,
            string userId,
            int albumId,
            CommentRequest comment)
        {
            MediaAlbum albumEntity = await dbContext.MediaAlbums
                .SingleOrDefaultAsync(te => te.MediaAlbumId == albumId);
            if (albumEntity == null)
            {
                // The entry id is part of the URL, so return a 404.
                return HttpStatusCode.NotFound;
            }

            return await CommentOperations.AddCommentAsync(
                dbContext,
                userId,
                new CommentItemIds { AlbumId = albumId },
                e => e.CommentThread,
                albumEntity,
                comment);
        }
Exemple #5
0
 public async Task PostComment(int albumId, CommentRequest commentRequest)
 {
     HttpStatusCode result = await AlbumOperations.AddAlbumCommentAsync(
         DbContext, UserId, albumId, commentRequest);
     result.ThrowHttpResponseExceptionIfNotSuccessful();
 }