Пример #1
0
        public ActionResult Search(UsersSearchModel searchModel)
        {
            try
            {
                var totalRows = 0;
                var listUsers = _accountBo.GetList(searchModel.Keyword, out totalRows, searchModel.UserType, searchModel.PageIndex, searchModel.PageSize);
                if (listUsers != null)
                {
                    List <UsersModel> models = listUsers.Select(item => new UsersModel(item)).ToList();
                    Msg.Error = false;
                    var pager = new Pager {
                        CurrentPage = searchModel.PageIndex, PageSize = searchModel.PageSize, TotalItem = totalRows
                    };

                    Msg.Obj = new { Data = models, Pager = pager };
                }
                else
                {
                    Msg.Obj = new { Data = listUsers, Pager = new Pager() };
                }
            }
            catch (Exception ex)
            {
                Msg.Obj   = null;
                Msg.Error = true;
            }
            return(AuthorizeJson(Msg));
        }
Пример #2
0
        public ActionResult Search(UsersSearchModel searchModel)
        {
            ResponseData responseData = new ResponseData();
            var          totalRows    = 0;
            var          listUsers    = _accountBo.GetList(searchModel.Keyword, out totalRows, searchModel.UserType, searchModel.PageIndex, searchModel.PageSize);

            if (listUsers != null)
            {
                List <UsersModel> models = listUsers.Select(item => new UsersModel(item)).ToList();
                responseData.Data     = models;
                responseData.TotalRow = totalRows;
                responseData.Success  = true;
                responseData.Message  = StringUtils.GetEnumDescription(ErrorCodes.Success);
            }

            return(Json(responseData));
        }