public CustomPrincipal(Account account)
 {
     this.account = account;
     if (account == null)
     {
         this.Identity = null;
     }
     else
     {
         this.Identity = new GenericIdentity(account.Username);
     }
 }
 public List<Account> GetListAccounts(IEnumerable<User> listusers)
 {
     List<Account> listAccounts = new List<Account>();
     foreach (var item in listusers)
     {
         var model = new Account();
         model.UserId = item.Id;
         model.Username = item.Username;
         model.Password = MD5Helper.Decrypt(item.Password,true);
         model.Roles = new string[] {GetNameHelper.GetRoleName(item.IdRole) };
         listAccounts.Add(model);
     }
     return listAccounts;
 }