public ActionResult Create(User customer) { ReturnObj returnObj = new ReturnObj(); customer.UserID = Guid.NewGuid(); customer.Password = MD5Helper.ToString(customer.Password); if (iUserManager.Save(customer) > 0) { returnObj.State = 1; returnObj.Msg = "保存成功!"; } else { returnObj.State = -1; returnObj.Msg = "保存失败!"; } return Json(returnObj, JsonRequestBehavior.AllowGet); }
/// <summary> /// 用于向 Users EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
/// <summary> /// 创建新的 User 对象。 /// </summary> /// <param name="userID">UserID 属性的初始值。</param> /// <param name="loginID">LoginID 属性的初始值。</param> /// <param name="password">Password 属性的初始值。</param> public static User CreateUser(global::System.Guid userID, global::System.String loginID, global::System.String password) { User user = new User(); user.UserID = userID; user.LoginID = loginID; user.Password = password; return user; }
public ActionResult Edit(User user) { iUserManager.Update(user); return RedirectToAction("Index"); }