public ActionResult Edit(int id)
        {
            var service = CreateOpponentService();
            var detail  = service.GetOpponentById(id);
            var model   = new OpponentEdit
            {
                EventId = detail.EventId,
                Name    = detail.Name
            };

            return(View(model));
        }
        public ActionResult Edit(int id, OpponentEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.EventId != id)
            {
                ModelState.AddModelError("", "Id does not match");
                return(View(model));
            }
            var service = CreateOpponentService();

            if (service.UpdateOpponent(model))
            {
                TempData["SaveResult"] = "Opponent updated successfully.";
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Opponent could not be updated.");
            return(View());
        }