Пример #1
0
        public ActionResult CreateComment(CommentModels newComment)
        {
            if (User.Identity.IsAuthenticated)
            {
                var userName = HttpContext.User.Identity.Name;
                dbHelper.CreateNewComment(newComment, _dealId, userName);
            }

            return RedirectToAction("../Oferta/" + _dealId.ToString());
        }
Пример #2
0
        public void EditComment(CommentModels newComment)
        {
            var comment = (from c in dbStore.Comment
                           where c.CommentsModelsId == newComment.CommentsModelsId
                           select c).Single();

            comment.Content = newComment.Content;
            comment.Title = newComment.Title;
            comment.Rank = newComment.Rank;
            comment.Data = newComment.Data;

            dbStore.Entry(comment).State = System.Data.EntityState.Modified;
            dbStore.SaveChanges();
            dbStore = new RazemTaniejEntities();
        }
Пример #3
0
 public void CreateNewComment(CommentModels newComment, int _dealId, string userName)
 {
     newComment.Data = DateTime.Now;
     newComment.Deal = GetDeal(_dealId);
     IncrementDealComments(newComment.Deal);
     newComment.User = GetUser(userName);
     DataBase.Comment.Add(newComment);
     DataBase.SaveChanges();
     dbStore = new RazemTaniejEntities();
 }
Пример #4
0
 public ActionResult EditComment(CommentModels comment)
 {
     dbHelper.EditComment(comment);
     return RedirectToAction("ShowAllUserPanel");
 }