Esempio n. 1
0
        public ActionResult Following()
        {
            var idCard = ((System.Web.HttpContext.Current.User as MyIdentity.MyPrincipal).Identity as MyIdentity).User.IdCard;
            var model  = new FollowersViewModel();
            List <PR_GetFriends_Result> customers     = db.PR_GetFriends(idCard).ToList();
            List <ProfileModel>         profileModels = new List <ProfileModel>();

            foreach (var account in customers)
            {
                var profile = new ProfileModel();
                profile.IdCard    = account.IdCard;
                profile.Username  = account.Username;
                profile.FirstName = account.FirstName;
                profile.LastName  = account.LastName;
                profile.LastName  = account.LastName;

                ObjectParameter followersQty = new ObjectParameter("Qty", typeof(int));
                db.PR_GetFollowersCount(account.IdCard, followersQty);
                profile.Followers = (int)followersQty.Value;
                profile.Reviews   = db.Customer.Find(account.IdCard).Review.Count;
                profileModels.Add(profile);
            }
            model.Customers = profileModels;
            return(View(model));
        }