예제 #1
0
        public ReturnResponse <Pager <UserInfoViewModels> > Query(UserInfoQueryParameter parameter)
        {
            var userInfoAccount = _userInfoAccountDal.Query(parameter);
            var list            = new List <UserInfoViewModels>();
            var pagers          = new Pager <UserInfoViewModels>();

            if (userInfoAccount.Items.Any())
            {
                userInfoAccount.Items.Each(account =>
                {
                    var userInfoRes = _userInfoDal.Query(new UserInfoQueryParameter()
                    {
                        ID = account.UserInfoID
                    });
                    var userInfo = userInfoRes.Items.FirstOrDefault();
                    if (userInfo != null)
                    {
                        list.Add(new UserInfoViewModels()
                        {
                            Account     = account.Account,
                            AccountType = account.Account.GetAccountType(),
                            Password    = userInfo.Password,
                            CompanyName = userInfo.CompanyName,
                            Address     = userInfo.Address,
                            Gender      = userInfo.Gender,
                            NickName    = userInfo.NickName,
                            Id          = userInfo.Id
                        });
                    }
                });

                pagers.Total = userInfoAccount.Total;
                pagers.Pages = userInfoAccount.Pages;
                pagers.Items = list.ToArray();
                return(new ReturnResponse <Pager <UserInfoViewModels> >
                {
                    Body = pagers,
                    ResponseCode = 1,
                    Message = "Success"
                });
            }
            return(new ReturnResponse <Pager <UserInfoViewModels> >
            {
                Body = pagers,
                ResponseCode = 400,
                Message = "Not exist"
            });
        }