/// <summary>组装数据</summary> private ASObject BuildData(int result, tg_goods_item goods) { var dic = new Dictionary <string, object> { { "result", result }, { "goods", ConvertBusinessGoodsVo(goods) } }; return(new ASObject(dic)); }
/// <summary> tg_goods_item 转换 BusinessGoodsVo</summary> /// <param name="goods">tg_goods_item</param> private BusinessGoodsVo ConvertBusinessGoodsVo(tg_goods_item goods) { var bg = Variable.GOODS.FirstOrDefault(m => m.goods_id == goods.goods_id && m.ting_id == goods.ting_id); return(new BusinessGoodsVo() { id = goods.id, baseId = goods.goods_id, count = goods.number, priceBuy = bg.goods_buy_price, priceSell = bg.goods_sell_price, }); }
/// <summary>tg_goods_item 转换 BusinessGoodsVo</summary> /// <param name="goods">tg_goods_item</param> /// <returns>前端BusinessGoodsVo</returns> public static BusinessGoodsVo ToBusinessGoodsVo(tg_goods_item goods) { var bg = Variable.GOODS.FirstOrDefault(m => m.goods_id == goods.goods_id && m.ting_id == goods.ting_id); if (bg == null) { return(new BusinessGoodsVo()); } return(new BusinessGoodsVo { id = goods.id, baseId = goods.goods_id, count = goods.number, priceBuy = bg.goods_buy_price, priceSell = bg.goods_sell_price, }); }