This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Geocodio | |
{ | |
public string ApiKey { get; set; } | |
public GeocodioResponse GeoCodeByCityState(string address) | |
{ | |
var client = new RestClient("http://api.geocod.io/v1/"); | |
// client.Authenticator = new HttpBasicAuthenticator(username, password); | |
var request = new RestRequest("geocode", Method.GET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace PSI.Common.Appointments | |
{ | |
public enum AppointmentState | |
{ | |
[Description("Appointment #{0} Scheduled for {1} Confirmed and On Time")] | |
Confirmed = 0, | |
[Description("Appointment #{0} Scheduled for {1} Confirmed within Grace Peroid")] | |
ConfirmedWithinGracePeriod = 1, | |
[Description("Appointment #{0} Scheduled for {1} Confirmed Late")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PngProcessor : MediaTypeProcessor | |
{ | |
public PngProcessor(HttpOperationDescription operation, | |
MediaTypeProcessorMode mode) : base (operation, mode) | |
{ | |
} | |
public override IEnumerable< string > SupportedMediaTypes | |
{ | |
get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_Start(object sender, EventArgs e) | |
{ | |
var configuration = new ContactManagerConfiguration(); | |
RouteTable.Routes.AddServiceRoute<ContactResource>( “contact“, configuration); | |
RouteTable.Routes.AddServiceRoute<ContactsResource>( “contacts“, configuration); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceContract] | |
public class ContactsResource | |
{ | |
private static int nextId = 1; | |
[WebInvoke(UriTemplate = "", Method = "POST")] | |
public JsonValue Post(JsonValue contact) | |
{ | |
var postedContact = (dynamic)contact; | |
var contactResponse = (dynamic)new JsonObject(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContactManagerConfiguration : HostConfiguration | |
{ | |
public override void RegisterRequestProcessorsForOperation( HttpOperationDescription operation, | |
IList<Processor> processors, MediaTypeProcessorMode mode) | |
{ | |
processors.Add(new JsonProcessor(operation, mode)); | |
processors.Add(new FormUrlEncodedProcessor(operation, mode)); | |
} | |
public override void RegisterResponseProcessorsForOperation( HttpOperationDescription operation, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[WebGet(UriTemplate = "")] | |
[QueryComposition] | |
public IEnumerable<Contact> Get() | |
{ | |
return contacts.AsQueryable(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsonValueSampleConfiguration : HostConfiguration | |
{ | |
public override void RegisterRequestProcessorsForOperation( HttpOperationDescription operation, IList<Processor> processors, MediaTypeProcessorMode mode) | |
{ | |
processors.Add(new FormUrlEncodedProcessor(operation, mode)); | |
} | |
public override void RegisterResponseProcessorsForOperation( HttpOperationDescription operation, IList<Processor> processors, MediaTypeProcessorMode mode) | |
{ | |
processors.ClearMediaTypeProcessors(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new HttpClient(); | |
client.DefaultHeaders.Accept.Add("text/xml"); | |
var resp = client.Get("http://contoso.com/contacts/1"); | |
resp.Content.ReadAsXmlSerializable<Contact>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceContract] | |
public class DocumentResource | |
{ | |
[WebGet(UriTemplate="{name}")] | |
public Document Get(string name, HttpResponseMessage resp) | |
{ | |
Document doc; |
OlderNewer