コード例 #1
0
        public int CreateComment(CommentBLL comment)
        {
            int ProposedReturnValue = -1;

            ProposedReturnValue = _context.CreateComment(comment.GameComment, comment.UserID, comment.GameID, comment.Liked);
            return(ProposedReturnValue);
        }
コード例 #2
0
 public ActionResult Create(BusinessLogicLayer.CommentBLL collection)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(collection));
         }
         // TODO: Add insert logic here
         using (ContextBLL ctx = new ContextBLL())
         {
             UserBLL userRecord = ctx.FindUserByUserName(User.Identity.Name);
             if (null == userRecord)
             {
                 return(View("UserNotFound"));
             }
             collection.UserID = userRecord.UserID;
             ctx.CreateComment(collection);
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Exception = ex;
         return(View("Error"));
     }
 }
コード例 #3
0
        public CommentBLL FindCommentByLiked(bool Liked)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByLiked(Liked);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
コード例 #4
0
        public CommentBLL FindCommentByCommentID(int CommentID)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByCommentID(CommentID);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
コード例 #5
0
        public List <CommentBLL> GetCommentsRelatedToUserID(int UserID, int skip, int take)
        {
            List <CommentBLL> ProposedReturnValue    = new List <CommentBLL>();
            List <CommentDAL> ListOfDataLayerObjects = _context.GetCommentsRelatedToUserID(UserID, skip, take);

            foreach (CommentDAL comment in ListOfDataLayerObjects)
            {
                CommentBLL BusinessObject = new CommentBLL(comment);
                ProposedReturnValue.Add(BusinessObject);
            }
            return(ProposedReturnValue);
        }
コード例 #6
0
 public ActionResult Edit(int id, BusinessLogicLayer.CommentBLL collection)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(collection));
         }
         // TODO: Add update logic here
         using (ContextBLL ctx = new ContextBLL())
         {
             ctx.UpdateComment(collection);
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Exception = ex;
         return(View("Error"));
     }
 }
コード例 #7
0
 public void DeleteComment(CommentBLL comment)
 {
     _context.DeleteComment(comment.CommentID);
 }
コード例 #8
0
 public void UpdateComment(CommentBLL comment)
 {
     _context.UpdateComment(comment.CommentID, comment.GameComment, comment.UserID, comment.GameID, comment.Liked);
 }