(function () { BemsWebApplication.BemsEnergyGoalDailyViewModel = function (data) { this.SiteId = ko.observable(); this.BuildingId = ko.observable(); this.CreatedDate = ko.observable(); this.Goal = ko.observable(); if (data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsEnergyGoalDailyViewModel.prototype, { toJS: function () { return { SiteId: this.SiteId(), BuildingId: this.BuildingId(), CreatedDate: this.CreatedDate(), Goal: this.Goal(), }; }, fromJS: function (data) { if (data) { this.SiteId(data.SiteId); this.BuildingId(data.BuildingId); this.CreatedDate(data.CreatedDate); this.Goal(data.Goal); } } }); })();