public ActionResult Create(SiteConfig siteconfig) { if (ModelState.IsValid) { db.SiteConfigs.AddObject(siteconfig); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SiteStartCatID = new SelectList(db.Categories, "CatID", "CatName", siteconfig.SiteStartCatID); return View(siteconfig); }
public ActionResult Edit(SiteConfig siteconfig) { if (ModelState.IsValid) { db.SiteConfigs.Attach(siteconfig); db.ObjectStateManager.ChangeObjectState(siteconfig, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SiteStartCatID = new SelectList(db.Categories, "CatID", "CatName", siteconfig.SiteStartCatID); return View(siteconfig); }
/// <summary> /// Deprecated Method for adding a new object to the SiteConfigs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSiteConfigs(SiteConfig siteConfig) { base.AddObject("SiteConfigs", siteConfig); }
/// <summary> /// Create a new SiteConfig object. /// </summary> /// <param name="siteConfigID">Initial value of the SiteConfigID property.</param> public static SiteConfig CreateSiteConfig(global::System.Int64 siteConfigID) { SiteConfig siteConfig = new SiteConfig(); siteConfig.SiteConfigID = siteConfigID; return siteConfig; }