public ActionResult Edit([Bind(Include = "name,logoLink,foundedDate,stadium")] Club club)
 {
     if (ModelState.IsValid)
     {
         _repository.EditClub(club);
         return(RedirectToAction("Index"));
     }
     return(View(club));
 }
예제 #2
0
        public IActionResult Update(Club club)
        {
            Club dbClub;

            if (ModelState.IsValid)
            {
                dbClub = repository.EditClub(club);
                if (dbClub != null)
                {
                    TempData["message"] = $"Changes of \"{club.Name}\" have been saved";
                    return(RedirectToAction(nameof(HomeController.ClubDetails), "Home", new { clubid = dbClub.ClubID }));
                }
                TempData["warning"] = $"The club you were editing no longer exists";
                return(RedirectToAction(nameof(HomeController.Clubs), "Home"));
            }
            TempData["warning"] = $"Please complete this form";
            return(View(club));
        }
예제 #3
0
 public ActionResult EditClub(Club club)
 {
     clubrepo.EditClub(club);
     return(RedirectToAction("Club", "Club"));
 }