Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public bool PostNote(Note note)
        {
            using (var db = new BbsDbContext(_configuration))
            {
                db.Notes.Add(note);

                return((db.SaveChanges() > 0) ? true : false);
            }
        }