(function() { BemsWebApplication.CmZoneViewModel = function(data) { this.SiteId = ko.observable(); this.BuildingId = ko.observable(); this.FloorId = ko.observable(); this.ZoneId = ko.observable(); this.Name = ko.observable(); this.Target_temperature = ko.observable(); this.Target_humidity = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.CmZoneViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), BuildingId: this.BuildingId(), FloorId: this.FloorId(), ZoneId: this.ZoneId(), Name: this.Name(), Target_temperature: this.Target_temperature(), Target_humidity: this.Target_humidity(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.BuildingId(data.BuildingId); this.FloorId(data.FloorId); this.ZoneId(data.ZoneId); this.Name(data.Name); this.Target_temperature(data.Target_temperature); this.Target_humidity(data.Target_humidity); } } }); })();