Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PokemonTierAssignment pokemonTierAssignment = db.PokemonTierAssignments.Find(id);

            db.PokemonTierAssignments.Remove(pokemonTierAssignment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,PokemonLocalId,TierId")] PokemonTierAssignment pokemonTierAssignment)
        {
            if (ModelState.IsValid)
            {
                db.PokemonTierAssignments.Add(pokemonTierAssignment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pokemonTierAssignment));
        }
Ejemplo n.º 3
0
        // GET: PokemonTierAssignments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PokemonTierAssignment pokemonTierAssignment = db.PokemonTierAssignments.Find(id);

            if (pokemonTierAssignment == null)
            {
                return(HttpNotFound());
            }
            return(View(pokemonTierAssignment));
        }
Ejemplo n.º 4
0
        // GET: PokemonTierAssignments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PokemonTierAssignment pokemonTierAssignment = db.PokemonTierAssignments.Find(id);

            if (pokemonTierAssignment == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new PokemonTierAssignmentViewModel();

            var pokemonAssignedTiers = db.PokemonTierAssignments.Select(pt => pt.PokemonLocalId).ToList();

            viewModel.Name = db.PokemonLocals.Find(pokemonTierAssignment.PokemonLocalId).Name;
            viewModel.PokemonTierAssignment  = pokemonTierAssignment;
            viewModel.PokemonSelectListItems = new SelectList(db.PokemonLocals.Where(p => !pokemonAssignedTiers.Any(pt => pt == p.Id)).ToList(), "Id", "Name", selectedValue: pokemonTierAssignment.PokemonLocalId);
            viewModel.TierSelectListItems    = new SelectList(db.DraftTiers.ToList(), "Id", "Name");

            return(View(viewModel));
        }