(function() { BemsWebApplication.BemsPeakHistoryViewModel = function(data) { this.SiteId = ko.observable(); this.CreatedDateTime = ko.observable(); this.CurrentValue = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsPeakHistoryViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), CreatedDateTime: this.CreatedDateTime(), CurrentValue: this.CurrentValue(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.CreatedDateTime(data.CreatedDateTime); this.CurrentValue(data.CurrentValue); } } }); })();