Beispiel #1
0
        public static WebResponse <IEnumerable <OrderWebModel> > AsWebResponse(this GetOrdersBySenderEmailResponse response)
        {
            var result = new WebResponse <IEnumerable <OrderWebModel> >(response.Data?.AsWebModel())
            {
                Message    = response.Message,
                ErrorCode  = response.ErrorCode,
                StatusCode = response.StatusCode
            };

            return(result);
        }
Beispiel #2
0
        public async Task <GetOrdersBySenderEmailResponse> GetOrdersBySenderEmailAsync(GetOrdersBySenderEmailRequest request)
        {
            var result = new GetOrdersBySenderEmailResponse();

            try
            {
                //// Convert Entity (Service) model to Shared (Infra) model using `AsModel` extension
                result.Data = (await this.dataGateway.GetOrdersBySenderEmailAsync(request.SenderEmail)).AsModel();
            }
            catch (Exception ex)
            {
                //// Wrap exception and rethrow
                this.logger.WriteException(ex);
                throw new OrderServiceException(ex);
            }

            return(result);
        }