예제 #1
0
        public ActionResult Create(Template template)
        {
            if (ModelState.IsValid)
            {
                db.Templates.AddObject(template);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(template);
        }
예제 #2
0
 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);
 }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Templates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTemplates(Template template)
 {
     base.AddObject("Templates", template);
 }
예제 #4
0
 /// <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;
 }