Example #1
0
        public JsonResult DeleteUser(int id)
        {
            //获得Model
            var model = userService.GetUserById(id);

            userService.DeleteTrue(model, null);

            var data = this.GetList().AsEnumerable();
            var dto  = data.ToDto();

            dto = dto.OrderByDescending(e => e.id).AsEnumerable();

            //返回给Json
            return(Json(dto, JsonRequestBehavior.AllowGet));
        }
Example #2
0
 /// <summary>
 /// Gets the current user.
 /// </summary>
 /// <returns></returns>
 protected iPow.Infrastructure.Data.DataSys.Sys_AdminUser GetCurrentUser()
 {
     if (cachedUser != null)
     {
         return(cachedUser);
     }
     else
     {
         Data.DataSys.Sys_AdminUser adminUser = null;
         if (httpContext != null)
         {
             //cookie
             adminUser = GetUserByCookie();
             if (adminUser == null)
             {
                 adminUser = GetUserBySession();
                 if (adminUser != null)
                 {
                     cachedUser = adminUser;
                 }
                 else
                 {
                     //check whether request is made by a search engine
                     //in this case return built-in Data.DataSys.Sys_AdminUser record for search engines
                     //or comment the following two lines of code in order to disable this functionality
                     if (iPow.Infrastructure.Crosscutting.Function.StringHelper.IsSearchEngine(httpContext.Request))
                     {
                         //搜索引擎用户
                         adminUser = userService.GetUserById(iPow.Infrastructure.Crosscutting.Comm.Service.ConstService.UserSearchEngineUserId);
                     }
                 }
             }
             else
             {
                 cachedUser = adminUser;
             }
         }
     }
     return(cachedUser);
 }