public GoodsListResponseForU GetAllGoods() { GoodsListResponseForU response = new GoodsListResponseForU(); List <Goods> listgoods = gr.GetAllGoodsList(); response.ToalCount = gr.GetAllGetGoods().Result.Count; List <GoodsItemListForU> goodsitemlistforu = new List <GoodsItemListForU>(); for (int i = 0; i < listgoods.Count; i++) { GoodsItemListForU gli = new GoodsItemListForU(); gli.GoodsId = listgoods[i].GoodsId; gli.GoodsName = listgoods[i].GoodsName; gli.GoodsPrice = listgoods[i].GoodsPrice; gli.GoodsKind = listgoods[i].GoodsKind; gli.GoodsNum = listgoods[i].GoodsNum; goodsitemlistforu.Add(gli); } response.GoodsItemListGorU = goodsitemlistforu; return(response); }
public async Task <GoodsListResponseForU> GetGoodsByName(string name) { GoodsListResponseForU response = new GoodsListResponseForU(); response.ToalCount = gr.GetGoodsDetialByName(name).Result.Count; List <Goods> goods = new List <Goods>(); goods = await gr.GetGoodsDetialByName(name); for (int i = 0; i < goods.Count; i++) { GoodsItemListForU goodsitem = new GoodsItemListForU(); goodsitem.GoodsId = goods[i].GoodsId; goodsitem.GoodsName = goods[i].GoodsName; goodsitem.GoodsPrice = goods[i].GoodsPrice; goodsitem.GoodsNum = goods[i].GoodsNum; response.GoodsItemListGorU.Add(goodsitem); } return(response); }