Пример #1
0
        public SplitTraOrderResponseViewModel SplitTraOrder(SplitTraOrderRequestViewModel request, out string Message)
        {
            Message = "";
            SplitTraOrderResponseViewModel responseViewModel = new SplitTraOrderResponseViewModel();

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    //返回生成的订单号组
                    responseViewModel.OrderIdList = _SplitTraOrderServiceBll.SplitOrder(request.OrderId, request.Oid);
                    if (responseViewModel.OrderIdList.Count > 0)
                    {
                        Message = "订单拆分成功";
                    }

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    Message = ex.Message;
                    transaction.Rollback();
                    throw;
                }
            }
            return(responseViewModel);
        }
Пример #2
0
        public async Task <ResponseBaseViewModel <SplitTraOrderResponseViewModel> > SplitTraOrder(
            [FromBody] SplitTraOrderRequestViewModel request)
        {
            request.Oid = this.GetOid();
            string message = "";
            SplitTraOrderResponseViewModel viewModel = new SplitTraOrderResponseViewModel();

            await new TaskFactory().StartNew(() =>
            {
                viewModel = _SplitTraOrderApplication.SplitTraOrder(request, out message);
            });

            ResponseBaseViewModel <SplitTraOrderResponseViewModel> returnval = new ResponseBaseViewModel
                                                                               <SplitTraOrderResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = 0, MojoryToken = this.GetToken(), Message = message
                },
                Data = viewModel
            };

            return(returnval);
        }