(function() {
    BemsWebApplication.FmsMaterialCodePurchaseTypeViewModel = function(data) {
            this.PurchaseTypeId = ko.observable();
            this.Name = ko.observable();
            this.Comment = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsMaterialCodePurchaseTypeViewModel.prototype, {
        toJS: function() {
            return {
                PurchaseTypeId: this.PurchaseTypeId(),
                Name: this.Name(),
                Comment: this.Comment(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.PurchaseTypeId(data.PurchaseTypeId);
                this.Name(data.Name);
                this.Comment(data.Comment);

            }
        }
    });
})();