Ejemplo n.º 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
                    }));
                }
            }
        }
Ejemplo n.º 2
0
 public SubCommentEvent AddNewSubComment(SubCommentEvent subComment)
 {
     using (var db = new Ws_DataContext())
     {
         var newComment = db.SubCommentEvent.Add(subComment);
         db.SaveChanges();
         return(newComment);
     }
 }