public async Task <ActionResult> SellList(SpotGoodsQueryRequest request) { if (!Request.IsAjaxRequest()) { return(View(request)); } var manager = new SpotGoodsManager(User); var paging = await manager.GetSpotGoodsOrderListAsync(request.Start, request.Take, request.GetSpotGoodsOrderListQueryFilter()); var spotGoodList = paging.List.Select(u => { var spotGoods = Mapper.Map <SpotGoodsOrder, SpotGoodsOrderViewModel>(u); return(spotGoods); }); return(Json(true, string.Empty, new { paging.Total, List = spotGoodList })); }
public async Task <IHttpActionResult> SpotGoods(SpotGoodsQueryRequest request) { var manager = new SpotGoodsManager(); var spotGoods = await manager.GetSpotGoodsAsync(request.GetSpotGoodsListQueryFilter()); if (spotGoods == null) { return(NotFound("现货不存在")); } var spotGoodsViewModel = new SpotGoodListItemViewModel(spotGoods); var dailyGoldPriceManager = new DailyGoldPriceManager(); var dailyGoldPrice = await dailyGoldPriceManager.GetNewDailyGoldPriceAsync(spotGoodsViewModel.ColorFormId); spotGoodsViewModel.DailyGoldPrice = dailyGoldPrice.Price; if (spotGoodsViewModel.Price == 0) { var goldCost = dailyGoldPrice.Price * spotGoodsViewModel.GoldWeight * (1 + (double)spotGoodsViewModel.Loss18KRate / 100); spotGoodsViewModel.Price = decimal.Round(((decimal)(spotGoodsViewModel.BasicCost + goldCost + spotGoods.SetStoneInfos.Sum(r => r.Price * r.Weight + r.Number * r.WorkingCost))), 2); } return(Ok(spotGoodsViewModel)); }