Example #1
0
        public IHttpActionResult AddSubComment(AddSubCommentDTO comment)
        {
            int CurrenUser = 0;

            using (var db = new UserDAL())
            {
                CurrenUser = db.GetUserByUserNameOrEmail(User.Identity.Name).UserID;
            }
            var newSubComment = new SubCommentEvent
            {
                UserId         = CurrenUser,
                CommentEventId = comment.CommentThreadId,
                Content        = comment.CommentContent,
                Status         = true,
                CommentDate    = DateTime.Now
            };

            using (var db = new EventDAL())
            {
                try
                {
                    newSubComment = db.AddNewSubComment(newSubComment);
                    return(Ok(new HTTPMessageDTO {
                        Status = WsConstant.HttpMessageType.SUCCESS
                    }));
                }
                catch (Exception)
                {
                    return(Ok(new HTTPMessageDTO {
                        Status = WsConstant.HttpMessageType.ERROR
                    }));
                }
            }
        }