Skip to content

Instantly share code, notes, and snippets.

@mekhami
Created December 8, 2015 23:11
Show Gist options
  • Select an option

  • Save mekhami/9d9d8d1cea8a3cb18e39 to your computer and use it in GitHub Desktop.

Select an option

Save mekhami/9d9d8d1cea8a3cb18e39 to your computer and use it in GitHub Desktop.
.factory('rsvpDataService', ['$http', function($http) {
var service = {};
service.getAllRsvp = function() {
return $http.get('/api/rsvps/');
};
service.getRsvp = function(code) {
return $http.get('/api/rsvps/code/'+code.toUpperCase());
};
service.getRsvpById = function(id) {
return $http.get('/api/rsvps/id/'+id);
};
service.updateRsvp = function(formData) {
return $http.post('/api/rsvps/code/'+formData.code.toUpperCase(), formData);
};
service.createRsvp = function(formData) {
return $http.post('/api/rsvps/create', formData);
};
service.deleteRsvp = function(id) {
return $http.delete('/api/rsvps/id/'+id);
};
return service;
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment