(function() { BemsWebApplication.BemsPeakInfoViewModel = function(data) { this.SiteId = ko.observable(); this.MaxDateTime = ko.observable(); this.MaxPeakValue = ko.observable(); this.MinDateTime = ko.observable(); this.MinPeakValue = ko.observable(); this.todayMaxPeakValue = ko.observable(); this.todayMinPeakValue = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsPeakInfoViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), MaxDateTime: this.MaxDateTime(), MaxPeakValue: this.MaxPeakValue(), MinDateTime: this.MinDateTime(), MinPeakValue: this.MinPeakValue(), todayMaxPeakValue: this.todayMaxPeakValue(), todayMinPeakValue: this.todayMinPeakValue() }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.MaxDateTime(data.MaxDateTime); this.MaxPeakValue(data.MaxPeakValue); this.MinDateTime(data.MinDateTime); this.MinPeakValue(data.MinPeakValue); this.todayMaxPeakValue(data.todayMaxPeakValue); this.todayMinPeakValue(data.todayMinPeakValue); } } }); })();