Ejemplo n.º 1
0
        public static GetLocationsResponse Unmarshall(UnmarshallerContext context)
        {
            GetLocationsResponse getLocationsResponse = new GetLocationsResponse();

            getLocationsResponse.HttpResponse = context.HttpResponse;
            getLocationsResponse.StoreId      = context.LongValue("GetLocations.StoreId");

            List <GetLocationsResponse.GetLocations_LocationItem> getLocationsResponse_locationItems = new List <GetLocationsResponse.GetLocations_LocationItem>();

            for (int i = 0; i < context.Length("GetLocations.LocationItems.Length"); i++)
            {
                GetLocationsResponse.GetLocations_LocationItem locationItem = new GetLocationsResponse.GetLocations_LocationItem();
                locationItem.Status           = context.IntegerValue("GetLocations.LocationItems[" + i + "].Status");
                locationItem.StoreId          = context.LongValue("GetLocations.LocationItems[" + i + "].StoreId");
                locationItem.Name             = context.StringValue("GetLocations.LocationItems[" + i + "].Name");
                locationItem.Link             = context.BooleanValue("GetLocations.LocationItems[" + i + "].Link");
                locationItem.LocationType     = context.StringValue("GetLocations.LocationItems[" + i + "].LocationType");
                locationItem.LocationId       = context.LongValue("GetLocations.LocationItems[" + i + "].LocationId");
                locationItem.ParentLocationId = context.LongValue("GetLocations.LocationItems[" + i + "].ParentLocationId");
                locationItem.LayerType        = context.StringValue("GetLocations.LocationItems[" + i + "].LayerType");

                getLocationsResponse_locationItems.Add(locationItem);
            }
            getLocationsResponse.LocationItems = getLocationsResponse_locationItems;

            return(getLocationsResponse);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]
            [RequestBodyType(typeof(GetLocationsRequest), "Get Locations")] GetLocationsRequest req,
            CancellationToken cancellationToken)
        {
            try
            {
                var input = JsonConvert.SerializeObject(req);
                _logger.LogInformation(input);
                GetLocationsResponse response = await _mediator.Send(req, cancellationToken);

                return(new OkObjectResult(ResponseWrapper <GetLocationsResponse, AddressServiceErrorCode> .CreateSuccessfulResponse(response)));
            }
            catch (Exception exc)
            {
                _logger.LogErrorAndNotifyNewRelic("Exception occured in GetLocations", exc);
                _logger.LogError(exc.ToString(), exc);
                return(new ObjectResult(ResponseWrapper <GetLocationsResponse, AddressServiceErrorCode> .CreateUnsuccessfulResponse(AddressServiceErrorCode.UnhandledError, "Internal Error"))
                {
                    StatusCode = StatusCodes.Status500InternalServerError
                });
            }
        }