(function() { BemsWebApplication.FmsWorkCodeCycleUnitViewModel = function(data) { this.SiteId = ko.observable(); this.CycleUnitId = ko.observable(); this.Name = ko.observable(); this.Description = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsWorkCodeCycleUnitViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), CycleUnitId: this.CycleUnitId(), Name: this.Name(), Description: this.Description(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.CycleUnitId(data.CycleUnitId); this.Name(data.Name); this.Description(data.Description); } } }); })();