Beispiel #1
0
 public virtual ActionResult CreateParam(Param tosave)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var param = new Param();
             UpdateModel(param);
             Entities.AddToParams(param);
             Entities.SaveChanges();
             return RedirectToAction("SetParam");
         }
         catch
         {
             return View(tosave);
         }
     }
     ModelState.AddModelError("", "不能保存,请检查是否输入完整");
     return View(tosave);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Params EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToParams(Param param)
 {
     base.AddObject("Params", param);
 }
 /// <summary>
 /// Create a new Param object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Param CreateParam(global::System.Int32 id)
 {
     Param param = new Param();
     param.Id = id;
     return param;
 }