(function() { BemsWebApplication.BemsPriceCodeViewModel = function(data) { this.PriceCode = ko.observable(); this.PriceCodeDesc = ko.observable(); this.FuelTypeId = ko.observable(); this.Unit = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsPriceCodeViewModel.prototype, { toJS: function() { return { PriceCode: this.PriceCode(), PriceCodeDesc: this.PriceCodeDesc(), FuelTypeId: this.FuelTypeId(), Unit: this.Unit(), }; }, fromJS: function(data) { if(data) { this.PriceCode(data.PriceCode); this.PriceCodeDesc(data.PriceCodeDesc); this.FuelTypeId(data.FuelTypeId); this.Unit(data.Unit); } } }); })();