(function () {
    BemsWebApplication.CmUserLoginHistoryViewModel = function (data) {
        this.SiteId = ko.observable();
        this.UserId = ko.observable();

        this.LoginHistoryId = ko.observable();
        this.Type = ko.observable();
        this.TraceTime = ko.observable();
        this.IpAddress = ko.observable();
        
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.CmUserLoginHistoryViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                UserId: this.UserId(),
               
                LoginHistoryId: this.LoginHistoryId(),
                Type: this.Type(),
                TraceTime: this.TraceTime(),
                IpAddress: this.IpAddress(),
                
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.UserId(data.UserId);
                
                this.LoginHistoryId(data.LoginHistoryId);
                this.Type(data.Type);
                this.TraceTime(data.TraceTime);
                this.IpAddress(data.IpAddress);
                
            }
        }
    });
})();