public ActionResult Create([Bind(Include = "UserName,Body")] Comment comment) { comment.Created = DateTime.Now; if (ModelState.IsValid) { db.Comments.Add(comment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(comment)); }
public bool PostNote(Note note) { using (var db = new BbsDbContext(_configuration)) { db.Notes.Add(note); return((db.SaveChanges() > 0) ? true : false); } }