Пример #1
0
        public ActionResult Edit(int id, SportEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.SportId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = new SportService();

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

            ModelState.AddModelError("", "The sporting event could not be updated.");
            return(View());
        }