Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Comment Id</param>
        /// <returns></returns>
        public ActionResult DeleteComment(int?id)
        {
            int mid = 0;

            if (id.HasValue)
            {
                var c = ReviewCommentObject.GetReviewComment(id.Value);
                if (c != null)
                {
                    mid = c.MainId;
                    if (c.EmployeeId == Current.User.EmployeeId || Current.IsAdmin)
                    {
                        c.Delete();
                    }
                }
            }

            return(RedirectToAction("Index", new { id = mid }));
        }
Пример #2
0
        public JsonResult GetReviewComment(int?id)
        {
            if (id.HasValue)
            {
                var cmt = ReviewCommentObject.GetReviewComment(id.Value);
                if (cmt != null)
                {
                    var data = new
                    {
                        id       = cmt.ReviewCommentId,
                        reviewId = cmt.ReviewId,
                        comment  = cmt.Comment
                    };

                    return(Json(data));
                }
            }

            return(null);
        }
Пример #3
0
 public void Save()
 {
     if (CommentId.HasValue)
     {
         var c = ReviewCommentObject.GetReviewComment(CommentId.Value);
         if (c != null)
         {
             c.Comment = Comment;
             c.Save();
         }
     }
     else
     {
         var c = new ReviewCommentObject();
         c.MainId     = MainId;
         c.ReviewId   = CommentReviewId.Value;
         c.Comment    = Comment;
         c.EmployeeId = Current.User.EmployeeId;
         c.Save();
     }
 }