Esempio n. 1
0
 public virtual ActionResult Create(UserGroup tocreate)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var group = new UserGroup();
             UpdateModel(group);
             db.AddToUserGroups(group);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         catch
         {
             return View(tocreate);
         }
     }
     ModelState.AddModelError("", "不能创建,请检查是否输入完整");
     return View(tocreate);
 }
Esempio n. 2
0
 /// <summary>
 /// Create a new UserGroup object.
 /// </summary>
 /// <param name="groupID">Initial value of the GroupID property.</param>
 public static UserGroup CreateUserGroup(global::System.Int32 groupID)
 {
     UserGroup userGroup = new UserGroup();
     userGroup.GroupID = groupID;
     return userGroup;
 }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserGroups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserGroups(UserGroup userGroup)
 {
     base.AddObject("UserGroups", userGroup);
 }