示例#1
0
 public ActionResult Delete(Race race)
 {
     if (ModelState.IsValid)
     {
         repository.DeleteRace(race);
         return RedirectToRoute(new { controller = "Race", action = "List" });
     }
     else
     {
         return RedirectToRoute(new { controller = "Race", action = "Edit", id = race.RaceID });
     }
 }
示例#2
0
 public ActionResult Edit(Race race)
 {
     if (ModelState.IsValid)
     {
         // save the entity
         repository.SaveRace(race);
         // add a message to the viewbag
         TempData["message"] = string.Format("Race has been saved");
         // return the user to the list
         return RedirectToAction("List");
     }
     else
     {
         // there is something wrong with the data values
         return View(race);
     }
 }