(function () { BemsWebApplication.FmsBudgetViewModel = function (data) { this.SiteId = ko.observable(); this.Year = ko.observable(); if (data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsBudgetViewModel.prototype, { toJS: function () { return { SiteId: this.SiteId(), Year: this.Year(), }; }, fromJS: function (data) { if (data) { this.SiteId(data.SiteId); this.Year(data.Year); } } }); })();