Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Net;
  6. using System.Net.Http;
  7. using System.Security.Claims;
  8. using System.Web.Http;
  9. using System.Web.Http.Results;
  10.  
  11. namespace DoctorWebService.Controllers
  12. {
  13. public class DataController : ApiController
  14. {
  15. [Authorize]
  16. [HttpGet]
  17. [Route("api/doctors")]
  18. public JsonResult<object> Get(string doctorCode)
  19. {
  20. if (doctorCode == "666")
  21. {
  22. var identity = (ClaimsIdentity)User.Identity;
  23. return Json<object>(new
  24. {
  25. stampCode = "666",
  26. email = "666_doctor@gmail.com",
  27. phone = "+370 640 000000",
  28. healthCareProvider = "Jonavos poliklinika"
  29. });
  30. }
  31. else
  32. {
  33. return Json<object>(new
  34. {
  35. notFound = 0
  36. });
  37. }
  38. }
  39. }
  40. }
  41.  
  42. it returns:
  43.  
  44. {
  45. "stampCode": "666",
  46. "email": "666_doctor@gmail.com",
  47. "phone": "+370 640 000000",
  48. "healthCareProvider": "Jonavos poliklinika"
  49. }
  50.  
  51. [
  52. {
  53. "stampCode": "666",
  54. "email": "666_doctor@gmail.com",
  55. "phone": "+370 640 000000",
  56. "healthCareProvider": "Jonavos poliklinika"
  57. }
  58. ]
  59.  
  60. [
  61. "stampCode: 666",
  62. "email: 666_doctor@gmail.com",
  63. "phone: +370 640 000000",
  64. "healthCareProvider: Jonavos poliklinika"
  65. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement