public virtual ActionResult Create(Equipment tocreate)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var eq = new Equipment();
             UpdateModel(eq);
             db.AddToEquipments(eq);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         catch
         {
             ViewData["EqTypes"] = db.EquipmentTypes.ToList();
             return View(tocreate);
         }
     }
     ModelState.AddModelError("", "不能创建,请检查是否输入完整");
     ViewData["EqTypes"] = db.EquipmentTypes.ToList();
     return View(tocreate);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Equipments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEquipments(Equipment equipment)
 {
     base.AddObject("Equipments", equipment);
 }
 /// <summary>
 /// Create a new Equipment object.
 /// </summary>
 /// <param name="eID">Initial value of the EID property.</param>
 /// <param name="eTypeID">Initial value of the ETypeID property.</param>
 public static Equipment CreateEquipment(global::System.Int32 eID, global::System.Int32 eTypeID)
 {
     Equipment equipment = new Equipment();
     equipment.EID = eID;
     equipment.ETypeID = eTypeID;
     return equipment;
 }