ferngully-aurelia-tools
Version:
Ferngully Tools for Aurelia
66 lines • 3.48 kB
JavaScript
System.register(["aurelia-framework", "../ajax"], function (exports_1, context_1) {
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __moduleName = context_1 && context_1.id;
var aurelia_framework_1, ajax_1, FormSchemaCrudService;
return {
setters: [
function (aurelia_framework_1_1) {
aurelia_framework_1 = aurelia_framework_1_1;
},
function (ajax_1_1) {
ajax_1 = ajax_1_1;
}
],
execute: function () {
FormSchemaCrudService = (function () {
function FormSchemaCrudService(ajax) {
this.ajax = ajax;
}
FormSchemaCrudService.prototype.getAll = function (init) {
return this.ajax.fetchJson(this.webServiceName + "/Get", init)
.then(function (result) {
return result.Data;
});
};
FormSchemaCrudService.prototype.get = function (id) {
return this.ajax.fetchJson(this.webServiceName + "/Get/" + id)
.then(function (result) {
return result.Data;
});
};
FormSchemaCrudService.prototype.delete = function (id) {
return this.ajax.delete(this.webServiceName + "/Delete/" + id);
};
FormSchemaCrudService.prototype.create = function () {
return this.ajax.fetchJson(this.webServiceName + "/Create")
.then(function (result) {
return result.Data;
});
};
FormSchemaCrudService.prototype.insert = function (instance) {
return this.ajax.post(this.webServiceName + "/post", instance);
};
FormSchemaCrudService.prototype.update = function (id, instance, propertyName, newValue, oldValue) {
return this.ajax.put(this.webServiceName + "/Put/" + id, { instance: instance, propertyName: propertyName });
};
FormSchemaCrudService = __decorate([
aurelia_framework_1.autoinject,
aurelia_framework_1.transient(),
__metadata("design:paramtypes", [ajax_1.Ajax])
], FormSchemaCrudService);
return FormSchemaCrudService;
}());
exports_1("FormSchemaCrudService", FormSchemaCrudService);
}
};
});
//# sourceMappingURL=form-schema-crud-service.js.map