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); }
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); }