コード例 #1
0
        public async Task <ResponseBaseViewModel <SplitFltOrderResponseViewModel> > SplitFltOrder(
            [FromBody] SplitFltOrderRequestViewModel request)
        {
            request.Cid         = this.GetCid();
            request.OrderSource = this.GetOrderSource();
            request.Oid         = this.GetOid();
            SplitFltOrderResponseViewModel viewModel = new SplitFltOrderResponseViewModel();

            await new TaskFactory().StartNew(() =>
            {
                viewModel = _splitFltOrderApplication.SplitFltOrder(request);
            });

            ResponseBaseViewModel <SplitFltOrderResponseViewModel> v = new ResponseBaseViewModel
                                                                       <SplitFltOrderResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = 0, MojoryToken = this.GetToken()
                },
                Data = viewModel
            };

            return(v);
        }
コード例 #2
0
        public SplitFltOrderResponseViewModel SplitFltOrder(SplitFltOrderRequestViewModel request)
        {
            SplitFltOrderResponseViewModel responseViewModel = new SplitFltOrderResponseViewModel();

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    responseViewModel.OrderIdList = _splitFltOrderServiceBll.SplitFltOrderByPassenger(request.OrderId,
                                                                                                      request.Oid);
                    if (responseViewModel.OrderIdList == null || responseViewModel.OrderIdList.Count == 0)
                    {
                        throw new Exception("拆分异常");
                    }

                    foreach (var orderid in responseViewModel.OrderIdList)
                    {
                        _corpAduitOrderServiceBll.Copy(request.OrderId, orderid);
                    }

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }

            return(responseViewModel);
        }