Exemplo n.º 1
0
        public HttpResponseMessage Put([FromBody] XeGatewaySourceModel sourceModel)
        {
            var source = TheSourceManager.GetSourceById(sourceModel.Id);

            if (source == null)
            {
                Request.CreateResponse(System.Net.HttpStatusCode.BadRequest);
            }

            var sourceUpated = TheModelFacctory.Parse(sourceModel);

            TheSourceManager.UpdateSource(sourceUpated);
            return(Request.CreateResponse(System.Net.HttpStatusCode.OK));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetConversion(ConversionRequestModel request, Int64 sourceid)
        {
            if (request == null)
            {
                return(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest));
            }
            var source = TheSourceManager.GetSourceById(sourceid);

            if (source == null)
            {
                return(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest));
            }
            if (!source.Active)
            {
                return(Request.CreateResponse(System.Net.HttpStatusCode.MethodNotAllowed));
            }
            var conversionService = _serviceLocator.GetServiceByName(source.Name);
            var response          = conversionService.Convert(TheModelFacctory.Parse(request));


            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, TheModelFacctory.Create(response)));
        }