public ActionResult Create(SpecialTopic specialtopic) { if (ModelState.IsValid) { db.SpecialTopics.Add(specialtopic); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SpecialTopicTypeID = new SelectList(db.SpecialTopicTypDictionaries, "ID", "Name", specialtopic.SpecialTopicTypeID); ViewBag.ParentSpecialTopicID = new SelectList(db.SpecialTopics, "ID", "Name", specialtopic.ParentSpecialTopicID); return View(specialtopic); }
public ActionResult Edit(SpecialTopic specialtopic) { if (ModelState.IsValid) { db.Entry(specialtopic).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SpecialTopicTypeID = new SelectList(db.SpecialTopicTypDictionaries, "ID", "Name", specialtopic.SpecialTopicTypeID); ViewBag.ParentSpecialTopicID = new SelectList(db.SpecialTopics, "ID", "Name", specialtopic.ParentSpecialTopicID); return View(specialtopic); }