Exemplo n.º 1
0
        public ActionResult Index()
        {
            var user       = User.Identity.GetUserId();
            var followings = db.Followers.Where(x => x.VisiterId == user).Select(x => x.PlayerId);

            var f = followings.ToList();

            if (f == null)
            {
                var vm = new HomePlayerViewModel {
                    EmptyMessage = "yOK ", Images = null, Players = null, Vister = null
                };
                return(View(vm));
            }
            IList <Player> p = new List <Player>();

            foreach (var item in f)
            {
                p.Add(db.Players.FirstOrDefault(x => x.PlayerUserId == item));
            }
            var viewModel = new HomePlayerViewModel
            {
                Players      = p.ToList(),
                Images       = db.Imags.ToList(),
                EmptyMessage = "",
                Vister       = null
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var viewModel = new HomePlayerViewModel
            {
                Players = db.Players.ToList(),
                Images  = db.Imags.ToList(),
                Vister  = db.Visters.ToList()
            };

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public ActionResult Search(string SearchString)
        {
            var player = from x in db.Players
                         select x;

            if (!String.IsNullOrEmpty(SearchString))
            {
                player = player.Where(x => x.FullName.Contains(SearchString));
            }

            var viewModel = new HomePlayerViewModel {
                Players = player.Include(x => x.Image).ToList()
            };

            return(View(viewModel));
        }
        public ActionResult Photos(int?id)
        {
            var player = from x in db.Players
                         select x;
            var image = from y in db.Imags
                        select y;

            if (id != null)
            {
                player = player.Where(x => x.PlayerId == id);
                image  = image.Where(y => y.PlayerId == id);
            }
            var viewModel = new HomePlayerViewModel
            {
                Players = player.ToList(),
                Images  = image.ToList()
            };

            return(View(viewModel));
        }