Guest User

Untitled

a guest
Dec 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2. using System.ServiceModel.Web;
  3.  
  4. namespace WcfJsonRestService
  5. {
  6. public class Service1 : IService1
  7. {
  8. [WebInvoke(Method = "GET",
  9. ResponseFormat = WebMessageFormat.Json,
  10. UriTemplate = "data/{id}")]
  11. public Person GetData(string id)
  12. {
  13. // lookup person with the requested id
  14. return new Person()
  15. {
  16. Id = Convert.ToInt32(id),
  17. Name = "Leo Messi"
  18. };
  19. }
  20. }
  21.  
  22. public class Person
  23. {
  24. public int Id { get; set; }
  25. public string Name { get; set; }
  26. }
  27. }
Add Comment
Please, Sign In to add comment