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