示例#1
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var pokemon = new PokemonModel
                {
                    Name   = collection["Name"],
                    Number = int.Parse(collection["Number"])
                };

                if (pokemon.Save())
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(pokemon));
                }
            }
            catch
            {
                return(View());
            }
        }