Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ServiceModel.Web;
- namespace WcfJsonRestService
- {
- public class Service1 : IService1
- {
- [WebInvoke(Method = "GET",
- ResponseFormat = WebMessageFormat.Json,
- UriTemplate = "data/{id}")]
- public Person GetData(string id)
- {
- // lookup person with the requested id
- return new Person()
- {
- Id = Convert.ToInt32(id),
- Name = "Leo Messi"
- };
- }
- }
- public class Person
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
- }
Add Comment
Please, Sign In to add comment