Beispiel #1
0
        public async Task <BaseResponse <MerchandiseWrapper> > GetMerhandiseListDetail(BackStageSearchModel backStageSearchModel, string account)
        {
            try
            {
                if (backStageSearchModel == null)
                {
                    throw new ArgumentNullException(nameof(backStageSearchModel));
                }
                var customerData = context.Merchandise.Where(data => data.OwnerAccount == account);

                Console.WriteLine(backStageSearchModel.PageIndex);
                var customerDataList      = customerData.OrderBy(backStageSearchModel.OrderString, backStageSearchModel.isOrderByDesc).Page(backStageSearchModel.PageIndex, backStageSearchModel.PageSize).Select(data => mapper.Map <Merchandise, MerchandiseViewModel>(data)).ToList();
                MerchandiseWrapper result = new MerchandiseWrapper()
                {
                    MerchandiseViewModel = customerDataList,
                    MerchandiseAmount    = customerData.Count()
                };
                Console.WriteLine(result);



                return(new BaseResponse <MerchandiseWrapper>(true, "", result));
            }
            catch (Exception ex)
            {
                return(new BaseResponse <MerchandiseWrapper>(false, "cannot get merchandise list", null));
            }
        }
Beispiel #2
0
        public async Task <BaseResponse <MerchandiseWrapper> > GetBSMerhandiseListDetail([FromBody] BackStageSearchModel backStageSearchModel)
        {
            string account = "tychang";

            //backStageSearchModel.PageIndex = 0;
            //backStageSearchModel.PageSize = 1;
            //backStageSearchModel.OrderString = "Price";
            return(await merchandiseService.GetMerhandiseListDetail(backStageSearchModel, account).ConfigureAwait(false));
        }