public ActionResult PostComment(PublicComment model)
        {
            if (model != null)
            {
                model.CommentDateTime = DateTime.Now;
                model.CommentUserId   = User.Identity.GetUserId();

                var result = _noticeBoardManager.PostComment(model);

                return(Content(result.ToString()));
            }
            return(Content(Boolean.FalseString));
        }
Beispiel #2
0
        // Currently Admin is free to approve new notice but we will impliment it very soon.

        //public void ApproveNotice(int id)
        //{
        //    var notice = _data.Notice.FirstOrDefault(x => x.Id == id);
        //    notice.IsApproved = true;

        //    _data.Entry(notice).State = EntityState.Modified;
        //    _data.SaveChanges();

        //}

        public bool PostComment(PublicComment comment)
        {
            try
            {
                _data.PublicComments.Add(comment);
                _data.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                //TODO: Have to log the error.
                return(false);
            }
        }