ferngully-aurelia-tools
Version:
Ferngully Tools for Aurelia
51 lines • 2.47 kB
JavaScript
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);
};
import { autoinject, transient } from "aurelia-framework";
import { Ajax } from "../ajax";
var 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([
autoinject,
transient(),
__metadata("design:paramtypes", [Ajax])
], FormSchemaCrudService);
return FormSchemaCrudService;
}());
export { FormSchemaCrudService };
//# sourceMappingURL=form-schema-crud-service.js.map