Пример #1
0
        public ActionResult DeleteSquad(int?id)
        {
            FirstSquad fs = db.FirstSquad.Find(id);

            db.FirstSquad.Remove(fs);
            db.SaveChanges();

            return(RedirectToAction("FirstSquad1"));
        }
Пример #2
0
        public ActionResult FirstSquad(int?id)
        {
            Player pl = db.Players.Find(id);

            FirstSquad fs = new FirstSquad {
                Image = pl.Image, FirstName = pl.FirstName, LastName = pl.LastName, Age = pl.Age, Country = pl.Country, position = pl.position, Number = pl.Number, Rating = pl.Rating
            };

            db.FirstSquad.Add(fs);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ViewResult FirstSquad1()
        {
            List <FirstSquad> firstSquadPlayers = new List <FirstSquad>();
            var squad = db.FirstSquad.Select(s => s);

            FirstSquad fs = null;

            foreach (var item in squad)
            {
                fs = item;
                firstSquadPlayers.Add(fs);
            }
            return(View(firstSquadPlayers));
        }