BootstrapAdmin/Bootstrap.Admin/Models/HeaderBarModel.cs

37 lines
1.1 KiB
C#

using Bootstrap.DataAccess;
using System.IO;
using System.Security.Principal;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// </summary>
public class HeaderBarModel : ModelBase
{
/// <summary>
///
/// </summary>
/// <param name="identity"></param>
public HeaderBarModel(IIdentity identity)
{
var user = UserHelper.RetrieveUserByUserName(identity.Name);
Icon = Path.Combine(DictHelper.RetrieveIconFolderPath(), string.IsNullOrEmpty(user.Icon) ? DictHelper.RetrieveDefaultIcon() : user.Icon);
DisplayName = user.DisplayName;
UserName = user.UserName;
if (!string.IsNullOrEmpty(user.Css)) Theme = user.Css;
}
/// <summary>
///
/// </summary>
public string UserName { get; }
/// <summary>
///
/// </summary>
public string DisplayName { get; }
/// <summary>
/// 获得/设置 用户头像地址
/// </summary>
public string Icon { get; }
}
}