Пример #1
0
        public async Task <IActionResult> CreateDeliveryPointForRange([FromBody] List <PostalAddressDTO> postalAddressDTOs)
        {
            try
            {
                using (loggingHelper.RMTraceManager.StartTrace("WebService.CreateDeliveryPointForRange"))
                {
                    CreateDeliveryPointForRangeModelDTO createDeliveryPointForRangeModelDTO = null;
                    string methodName = typeof(DeliveryPointController) + "." + nameof(CreateDeliveryPointForRange);
                    loggingHelper.LogMethodEntry(methodName, priority, entryEventId);

                    if (!ModelState.IsValid)
                    {
                        return(BadRequest(ModelState));
                    }

                    createDeliveryPointForRangeModelDTO = await businessService.CreateDeliveryPointForRange(postalAddressDTOs);

                    loggingHelper.LogMethodExit(methodName, priority, exitEventId);

                    return(Ok(createDeliveryPointForRangeModelDTO));
                }
            }
            catch (AggregateException ae)
            {
                foreach (var exception in ae.InnerExceptions)
                {
                    loggingHelper.Log(exception, TraceEventType.Error);
                }

                var realExceptions = ae.Flatten().InnerException;
                throw realExceptions;
            }
        }
Пример #2
0
 public async Task Test_CreateDeliveryPointForRange_NegativeScenario()
 {
     Assert.ThrowsAsync <ArgumentNullException>(() => testCandidate.CreateDeliveryPointForRange(null));
 }