Exemplo n.º 1
0
 public CommentInfo AddComment(long postId, CommentInfo info, bool isWeb)
 {
     try
     {
         CommentManager mgr = new CommentManager();
         TokenInfo tokenInfo = new HelperMethods().GetUserToken<TokenInfo>(isWeb, HttpContext.Current);
         info.PostId = postId;
         info.UserIdf = tokenInfo.Idf;
         return mgr.AddComment(info, tokenInfo.TerritoryId);
     }
     catch (Exception ex)
     {
         throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.InternalServerError);
     }
 }
Exemplo n.º 2
0
 public List<CommentInfo> GetOwnComments(long postId, int pageId, int pageSize, bool isWeb)
 {
     try
     {
         CommentManager mgr = new CommentManager();
         HelperMethods helperMgr = new HelperMethods();
         Guid userIdf = helperMgr.GetUserIdf(isWeb, HttpContext.Current);
         return mgr.GetOwnComments(userIdf, postId, pageId, helperMgr.SetPageSize(pageSize, isWeb));
     }
     catch (Exception ex)
     {
         throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.InternalServerError);
     }
 }
Exemplo n.º 3
0
 public List<CommentInfo> GetComments(long postId, int pageId, int pageSize, bool isWeb)
 {
     try
     {
         CommentManager mgr = new CommentManager();
         HelperMethods helperMgr = new HelperMethods();
         TokenInfo tokenInfo = new HelperMethods().GetUserToken<TokenInfo>(isWeb, HttpContext.Current);
         PostInfo post = new PostManager().GetPostById(tokenInfo.Idf, 0, tokenInfo.FolderPath, postId);
         if (post.isDone == true)
             return mgr.GetComments(tokenInfo.Idf, postId, pageId, helperMgr.SetPageSize(pageSize, isWeb));
         else
             return mgr.GetOwnComments(tokenInfo.Idf, postId, pageId, helperMgr.SetPageSize(pageSize, isWeb));
     }
     catch (Exception ex)
     {
         throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.InternalServerError);
     }
 }
Exemplo n.º 4
0
 public bool DeleteComment(long postId, CommentInfo info, bool isWeb)
 {
     try
     {
         CommentManager mgr = new CommentManager();
         Guid userIdf = new HelperMethods().GetUserIdf(isWeb, HttpContext.Current);
         info.PostId = postId;
         info.UserIdf = userIdf;
         return mgr.DeleteComment(info);
     }
     catch (Exception ex)
     {
         throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.InternalServerError);
     }
 }