コード例 #1
0
        public ActionResult Create(SportCreate model)
        {
            model.MediaType = MediaType.Sports;

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new SportService();

            if (service.CreateSport(model))
            {
                TempData["SaveResult"] = "The sporting event was created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "The sporting event could not be created.");

            return(View(model));
        }