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()); }
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(); }
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(); }
public ActionResult EditComment(CommentModels comment) { dbHelper.EditComment(comment); return RedirectToAction("ShowAllUserPanel"); }