public ActionResult Edit(ArmyModel a)
        {
            if (ModelState.IsValid) // jezeli spelnia atrybuty, walidatory
            {
                GameEntities ent = new GameEntities();
                Army         unit;// = new Army();
                unit             = ent.Armies.Where(x => x.Id == a.UnitId).FirstOrDefault();
                unit.Name        = a.Name;
                unit.Attack      = a.Attack;
                unit.Defence     = a.Defence;
                unit.KingdomId   = a.KingdomId;
                unit.Knowledge   = a.Knowledge;
                unit.MagicResist = a.MagicResist;
                unit.Quantity    = a.Quantity;
                ent.Entry(ent.Armies.Where(x => x.Id == a.UnitId).First()).CurrentValues.SetValues(unit);
                ent.SaveChanges();
                return(RedirectToAction("Index"));
            }

            else
            {
                GameEntities ent = new GameEntities();
                ViewData["Kingdom"] = ent.Kingdoms.Select(x => new SelectListItem()
                {
                    Value = x.Id.ToString(), Text = x.Name
                }).ToList();
                return(View(a));
            }
        }
        public ActionResult Edit(KingdomModel kingdom)
        {
            if (ModelState.IsValid) // jezeli spelnia atrybuty, walidatory np. Required
            {
                GameEntities ent = new GameEntities();
                Kingdom      k   = ent.Kingdoms.Where(x => x.Id == kingdom.Id).FirstOrDefault();
                k.Name       = kingdom.Name;
                k.Place      = kingdom.Place;
                k.Population = kingdom.Population;

                ent.Entry(ent.Kingdoms.Where(x => x.Id == k.Id).First()).CurrentValues.SetValues(k);
                ent.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(kingdom));
            }
        }