(function() { BemsWebApplication.FmsMaterialPurchaseOrderFileViewModel = function(data) { this.SiteId = ko.observable(); this.BusinessFieldId = ko.observable(); this.PurchaseOrderId = ko.observable(); this.FileId = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsMaterialPurchaseOrderFileViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), BusinessFieldId: this.BusinessFieldId(), PurchaseOrderId: this.PurchaseOrderId(), FileId: this.FileId(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.BusinessFieldId(data.BusinessFieldId); this.PurchaseOrderId(data.PurchaseOrderId); this.FileId(data.FileId); } } }); })();