Пример #1
0
 public ActionResult Form(Sys_User model, string password, string roleIds)
 {
     if (model.Id.IsNullOrEmpty())
     {
         //新增用户基本信息。
         var userId = _userService.Insert(model).ToString();
         //新增用户角色信息。
         _userRoleRelationService.SetRole(userId, roleIds.ToStrArray());
         //新增用户登陆信息。
         Sys_UserLogOn userLogOnEntity = new Sys_UserLogOn()
         {
             UserId   = userId,
             Password = password
         };
         var userLoginId = _userLogOnService.Insert(userLogOnEntity);
         return(userId != null && userLoginId != null?Success() : Error());
     }
     else
     {
         //更新用户基本信息。
         int row = _userService.Update(model);
         //更新用户角色信息。
         _userRoleRelationService.SetRole(model.Id, roleIds.ToStrArray());
         return(row > 0 ? Success() : Error());
     }
 }
Пример #2
0
 public ActionResult Form(Sys_UserLogOn model)
 {
     if (model.Id == null)
     {
         var primaryKey = _userLogOnService.Insert(model);
         return(primaryKey != null?Success() : Error());
     }
     else
     {
         var row = _userLogOnService.UpdateInfo(model);
         return(row > 0 ? Success() : Error());
     }
 }