public ActionResult Create(Template template) { if (ModelState.IsValid) { db.Templates.AddObject(template); db.SaveChanges(); return RedirectToAction("Index"); } return View(template); }
public ActionResult Edit(Template template) { if (ModelState.IsValid) { db.Templates.Attach(template); db.ObjectStateManager.ChangeObjectState(template, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(template); }
/// <summary> /// Deprecated Method for adding a new object to the Templates EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTemplates(Template template) { base.AddObject("Templates", template); }
/// <summary> /// Create a new Template object. /// </summary> /// <param name="tempID">Initial value of the TempID property.</param> /// <param name="tempName">Initial value of the TempName property.</param> /// <param name="tempDesc">Initial value of the TempDesc property.</param> /// <param name="tempURL">Initial value of the TempURL property.</param> public static Template CreateTemplate(global::System.Int64 tempID, global::System.String tempName, global::System.String tempDesc, global::System.String tempURL) { Template template = new Template(); template.TempID = tempID; template.TempName = tempName; template.TempDesc = tempDesc; template.TempURL = tempURL; return template; }