예제 #1
0
        private async Task <long> SaveReturnRequest(EditReturnRequest model)
        {
            if (model.ReturnRequestId == null)
            {
                var mCreateReturnRequestItems = new List <MFulfillment_CreateReturnRequestItem>();
                foreach (var item in model.ReturnRequestItems)
                {
                    mCreateReturnRequestItems.Add(new MFulfillment_CreateReturnRequestItem()
                    {
                        FulfillableItemId = item.FulfillableItemId,
                        Quantity          = item.Quantity
                    });
                }

                var mCreateReturnRequest = new MFulfillment_CreateReturnRequest()
                {
                    ReturnRequestType        = Enum.Parse <MFulfillment_ReturnRequestTypes>(model.ReturnRequestType),
                    ReturnRequestReasonCode  = model.ReturnRequestReason,
                    CreateReturnRequestItems = mCreateReturnRequestItems
                };

                var aCreateReturnRequest = new AReturn_CreateReturnRequest()
                {
                    MCreateReturnRequest = mCreateReturnRequest
                };

                var returnRequestId = await ReturnAdminService.CreateReturnRequestAsync(aCreateReturnRequest);

                return(returnRequestId);
            }
            else
            {
                var mUpdateReturnRequestItems = new List <MFulfillment_UpdateReturnRequestItem>();
                foreach (var item in model.ReturnRequestItems)
                {
                    mUpdateReturnRequestItems.Add(new MFulfillment_UpdateReturnRequestItem()
                    {
                        ReturnRequestItemId = item.ReturnRequestItemId.Value,
                        Quantity            = item.Quantity
                    });
                }

                var mUpdateReturnRequest = new MFulfillment_UpdateReturnRequest()
                {
                    ReturnRequestId          = model.ReturnRequestId.Value,
                    ReturnRequestType        = Enum.Parse <MFulfillment_ReturnRequestTypes>(model.ReturnRequestType),
                    ReturnRequestReasonCode  = model.ReturnRequestReason,
                    UpdateReturnRequestItems = mUpdateReturnRequestItems
                };

                var aUpdateReturnRequest = new AReturn_UpdateReturnRequest()
                {
                    MUpdateReturnRequest = mUpdateReturnRequest
                };

                await ReturnAdminService.UpdateReturnRequestAsync(aUpdateReturnRequest);

                return(model.ReturnRequestId.Value);
            }
        }
예제 #2
0
        public async Task UpdateReturnRequestAsync(AReturn_UpdateReturnRequest returnRequest)
        {
            using var log = BeginFunction(nameof(ReturnAdminService), nameof(UpdateReturnRequestAsync), returnRequest);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                await FulfillmentMicroService.UpdateReturnRequestAsync(returnRequest.MUpdateReturnRequest).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }