Exemplo n.º 1
0
        public AccountViewModel(Account customer, AccountCountingModel accountCounting)
        {
            Id              = customer.Id;
            Email           = customer.Email;
            Name            = customer.Name;
            Avatar          = !string.IsNullOrEmpty(customer.Avatar) ? customer.Avatar : "account/avatar.png";
            Type            = customer.Type;
            AccountCounting = new AccountCountingViewModel(accountCounting);
            Actived         = customer.Actived;

            // fix chưa có facebook provider
            if (customer.AccountProvider != null)
            {
                try
                {
                    var provider = customer.AccountProvider.FirstOrDefault(m => m.Provider == AccountProviderNames.Facebook);
                    if (provider != null)
                    {
                        Link = provider.Link;
                    }
                }
                catch { }
            }

            //###########################################################################
        }
Exemplo n.º 2
0
 public AccountViewModel(Account customer, AccountCountingModel accountCounting)
 {
     Id              = customer.Id;
     Email           = customer.Email;
     Name            = customer.Name;
     Avatar          = !string.IsNullOrEmpty(customer.Avatar) ? customer.Avatar : "account/avatar.png";
     Type            = customer.Type;
     AccountCounting = new AccountCountingViewModel(accountCounting);
 }
Exemplo n.º 3
0
 public AccountCountingViewModel(AccountCountingModel model)
 {
     if (model != null)
     {
         AvgShareCount   = Math.Round(model.AvgShareCount, 2);
         AvgLikeCount    = Math.Round(model.AvgLikeCount, 2);
         AvgCommentCount = Math.Round(model.AvgCommentCount, 2);
         FriendsCount    = model.FriendsCount;
         FollowersCount  = model.FollowersCount;
         FacebookLink    = model.FacebookLink;
         FacebookId      = model.FacebookId;
     }
 }