public int CreateComment(CommentBLL comment)
        {
            int ProposedReturnValue = -1;

            ProposedReturnValue = _context.CreateComment(comment.GameComment, comment.UserID, comment.GameID, comment.Liked);
            return(ProposedReturnValue);
        }
Esempio n. 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"));
     }
 }
        public CommentBLL FindCommentByLiked(bool Liked)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByLiked(Liked);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
        public CommentBLL FindCommentByCommentID(int CommentID)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByCommentID(CommentID);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
        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);
        }
Esempio n. 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"));
     }
 }
 public void DeleteComment(CommentBLL comment)
 {
     _context.DeleteComment(comment.CommentID);
 }
 public void UpdateComment(CommentBLL comment)
 {
     _context.UpdateComment(comment.CommentID, comment.GameComment, comment.UserID, comment.GameID, comment.Liked);
 }