Advertisement
Guest User

Repeated data

a guest
May 7th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.App = Em.Application.create({
  2.     LOG_TRANSITIONS: true
  3. });
  4.  
  5. App.Router.map(function () {
  6.     this.route("index", { path: "/" });
  7.     this.route('search');
  8.     this.route('calendar');
  9.     this.resource("users", function () {
  10.         this.resource("user", { path: "/:user_Id" });
  11.     });
  12. });
  13.  
  14. App.ApplicationAdapter = DS.RESTAdapter.reopen({
  15.     namespace: 'members'
  16. });
  17.  
  18. App.UsersRoute = Ember.Route.extend({
  19.     model: function () {
  20.         return this.store.find('user');
  21.     }
  22. });
  23.  
  24. App.UserRoute = Ember.Route.extend({
  25.     model: function(params) {
  26.         return this.store.find('user', params.user_Id);
  27.     }
  28. });
  29.  
  30. App.IndexRoute = Ember.Route.extend({
  31.     model: function () {
  32.         return this.store.find('user');
  33.     }
  34. });
  35.  
  36. var attr = DS.attr;
  37.  
  38. App.UserSerializer = DS.JSONSerializer.extend({
  39.     primaryKey: 'Id'
  40. });
  41.  
  42. App.User = DS.Model.extend({
  43.     FirstName: attr(''),
  44.     MiddleName: attr(''),
  45.     LastName: attr(''),
  46.     FullName: function() {
  47.         return this.get('FirstName') + ' ' + this.get('LastName');
  48.     }.property('FirstName', 'LastName'),
  49.     Email: attr(''),
  50.     HomeAddress: attr(''),
  51.     WorkAddress: attr(''),
  52.     City: attr(''),
  53.     State: attr(''),
  54.     Country: attr(''),
  55.     Zipcode: attr(''),
  56.     HomePhone: attr(''),
  57.     CellPhone: attr(''),
  58.     WorkPhone: attr(''),
  59.     InGroup: attr('boolean'),
  60.     DepartureTime: attr(''),
  61.     ArrivalTime: attr(''),
  62.     UserDob: attr(''),
  63.     UserTypeCode: attr(''),
  64.     DepartureCoord: attr(''),
  65.     DestinationCoord: attr('')
  66. });
  67.  
  68. JSON from C# API
  69.  
  70. {
  71. "FirstName": "Josue",
  72. "MiddleName": null,
  73. "LastName": "Cuetara",
  74. "UserDob": null,
  75. "Email": "j@h.com",
  76. "CellPhone": null,
  77. "Id": 20,
  78. "HomeAddress": null,
  79. "City": "Barranquitas",
  80. "State": "Puerto Rico",
  81. "Zipcode": "00729",
  82. "UserTypeCode": 1,
  83. "UserType": "Conductor",
  84. "HomePhone": null,
  85. "WorkPhone": null,
  86. "Country": "United States",
  87. "DepartureCoord": "18.325655, -66.106205",
  88. "DestinationCoord": "18.325655, -66.106205"
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement