Ejemplo n.º 1
0
        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <OrderInfoQueryDto> GetForModify(EntityQueryRequest input)
        {
            //  input.InitRequest();
            var orderInfo = await _orderInfoAppService.GetForModifyAsync(input);

            var userInfo = await RpcService.GetUserByIdAsync(orderInfo.UserId, input.Payload);

            orderInfo.UserName = userInfo.Name;
            return(orderInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <JsonResponse> Create(OrderInfoRequestDto input)
        {
            input.InitCreateRequest();
            input.UserId = input.CreateUserId;
            List <GoodsRequestDto> goodsQuerys = await RpcService.GetGoodsAsync(input);

            List <OrderDetailRequestDto> orderDetailRequestDtos = ToDetails(input, goodsQuerys);

            input.OrderNumber = DateTime.Now.ToString();
            input.TotalMoney  = orderDetailRequestDtos.Select(d => d.Money).Sum();
            input.ExpireTime  = DateTime.Now.AddDays(14);
            var resJson = await new ApplicationEnginee().TryTransactionAsync(async() =>
            {
                await _orderInfoAppService.CreateAsync(input);
                await _orderDetailAppService.BatchCreateAsync(orderDetailRequestDtos);
            });

            return(resJson);
        }