(function() { BemsWebApplication.BemsSitePriceHistoryViewModel = function (data) { this.SiteId = ko.observable(); this.FuelTypeId = ko.observable(); this.PriceTypeId = ko.observable(); this.PriceCode = ko.observable(); this.PriceValue = ko.observable(); this.PayDate = ko.observable(); this.StartDate = ko.observable(); this.EndDate = ko.observable(); this.PayCharge = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsSitePriceHistoryViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), FuelTypeId: this.FuelTypeId(), PriceTypeId: this.PriceTypeId(), PriceCode: this.PriceCode(), PriceValue: this.PriceValue(), PayDate: this.PayDate(), StartDate: this.StartDate(), EndDate: this.EndDate(), PayCharge: this.PayCharge(), }; }, fromJS: function(data) { if (data) { this.SiteId(data.SiteId); this.FuelTypeId(data.FuelTypeId); this.PriceTypeId(data.PriceTypeId); this.PriceCode(data.PriceCode); this.PriceValue(data.PriceValue); this.PayDate(data.PayDate); this.StartDate(data.StartDate); this.EndDate(data.EndDate); this.PayCharge(data.PayCharge); } } }); })();