(function() {
    BemsWebApplication.CmFloorViewModel = function(data) {
            this.SiteId = ko.observable();
            this.BuildingId = ko.observable();
            this.FloorId = ko.observable();
            this.Name = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.CmFloorViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                BuildingId: this.BuildingId(),
                FloorId: this.FloorId(),
                Name: this.Name(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.BuildingId(data.BuildingId);
                this.FloorId(data.FloorId);
                this.Name(data.Name);

            }
        }
    });
})();