(function() { BemsWebApplication.FmsMaterialPurchaseRequestMaterialViewModel = function(data) { this.SiteId = ko.observable(); this.BusinessFieldId = ko.observable(); this.PurchaseRequestId = ko.observable(); this.MaterialId = ko.observable(); this.MaterialCount = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsMaterialPurchaseRequestMaterialViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), BusinessFieldId: this.BusinessFieldId(), PurchaseRequestId: this.PurchaseRequestId(), MaterialId: this.MaterialId(), MaterialCount: this.MaterialCount(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.BusinessFieldId(data.BusinessFieldId); this.PurchaseRequestId(data.PurchaseRequestId); this.MaterialId(data.MaterialId); this.MaterialCount(data.MaterialCount); } } }); })();