public ActionResult Comment(TipsComment model) { var success = DataLogic.SaveComment(model); ModelState.Clear(); ViewBag.ThankYouForYourComment = "Tack för din kommentar!"; return(View()); }
public static bool SaveComment(TipsComment model) { using (var db = new FotbollsTipsModel()) { var comment = new TipsComment() { Name = model.Name, Comment = model.Comment, EntryDate = DateTime.Now }; db.TipsComments.Add(comment); db.SaveChanges(); } return(true); }