Esempio n. 1
0
 public void Create(UserDto model)
 {
     model.Enabled = false;
     model.PwdErrorCount = 0;
     model.LoginCount = 0;
     model.RegisterTime = DateTime.Now;
     UserRepository.Insert(model.MapTo<User>());
 }
Esempio n. 2
0
 public ActionResult Login(string LoginName, string LoginPwd)
 {
     var model = new UserDto() { LoginName = LoginName, LoginPwd = LoginPwd };
     model.LastLoginTime = DateTime.Now;
     var result = UserService.Login(model);
     Session["CurrentUser"] = model;
     Session.Timeout = 20;
     return Json(result);
 }
Esempio n. 3
0
 //<summary>
 //用户登录
 //</summary>
 //<param name="loginInfo">登录信息</param>
 //<returns>业务操作结果</returns>
 public OperationResult Login(UserDto model)
 {
     User user = UserRepository.Get(m=>m.LoginName == model.LoginName).FirstOrDefault();
     if (user == null)
     {
         return new OperationResult(OperationResultType.QueryNull, "指定账号的用户不存在。");
     }
     if (user.LoginPwd != model.LoginPwd)
     {
         return new OperationResult(OperationResultType.Warning, "登录密码不正确。");
     }
     return new OperationResult(OperationResultType.Success, "登录成功。", user);
 }
Esempio n. 4
0
 public ActionResult Edit(Guid? id)
 {
     UserDto model = null;
     if (!id.HasValue)  //新建
     {
         model = new UserDto();
         ViewBag.ActionName = "Create";
     }
     else  //编辑
     {
         model = UserService.GetById(id.Value);
         ViewBag.ActionName = "Update";
     }
     return View(model);
 }
Esempio n. 5
0
 public void Update(UserDto model)
 {
     var entity = UserRepository.GetByID(model.Id);
     UserRepository.Update(model.MapTo(entity));
 }
Esempio n. 6
0
 public JsonResult Update(UserDto model)
 {
     UserService.Update(model);
     return Json(1, JsonRequestBehavior.AllowGet);
 }