Beispiel #1
0
        // GET: History_for_player
        public ActionResult Index()
        {
            HistoryPlayersLoadsVM vm = new HistoryPlayersLoadsVM();
            var history_for_player   = db.History_for_player.Include(h => h.Load).Include(h => h.Player);

            return(View(history_for_player.ToList()));
        }
Beispiel #2
0
        public ActionResult Create(HistoryPlayersLoadsVM history)
        {
            if (ModelState.IsValid)
            {
                db.Loads.Add(history.L);
                if (db.SaveChanges() > 0)
                {
                    history.H.Loads_id = history.L.ID;
                    db.History_for_player.Add(history.H);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            //ViewBag.Loads_id = new SelectList(db.Loads, "ID", "ID", history_for_player.Loads_id);
            ViewBag.Player_id = new SelectList(db.Players, "ID", "Full_Name", history.H.Player_id);
            return(View(history));
        }