예제 #1
0
 public ActionResult Edit(ContentComment contentcomment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contentcomment).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TopicId = new SelectList(db.ContentTopics, "Id", "Title", contentcomment.TopicId);
     ViewBag.UserId = new SelectList(db.MemberUsers, "Id", "UserName", contentcomment.UserId);
     return View(contentcomment);
 }
예제 #2
0
        public ActionResult Create(ContentComment contentcomment)
        {
            if (ModelState.IsValid)
            {
                contentcomment.Id = Guid.NewGuid();
                db.ContentComments.Add(contentcomment);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TopicId = new SelectList(db.ContentTopics, "Id", "Title", contentcomment.TopicId);
            ViewBag.UserId = new SelectList(db.MemberUsers, "Id", "UserName", contentcomment.UserId);
            return View(contentcomment);
        }