예제 #1
0
 public ActionResult Edit(int id, CourtModel court)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     _courtServices.Update(id, court);
     return(RedirectToAction("Index"));
 }
예제 #2
0
 public ActionResult Create(CourtModel court)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     if (_courtServices.CourtExists(court.Name))
     {
         ModelState.AddModelError("Name", "Court with name " + court.Name + "  already exists!");
         return(View());
     }
     _courtServices.Create(court);
     return(RedirectToAction("Index"));
 }
예제 #3
0
 public void Update(int id, CourtModel model)
 {
     _courtRepository.Update(id, model.Name);
 }
예제 #4
0
 // Methods for courts
 public void Create(CourtModel model)
 {
     _courtRepository.Add(model.Name);
 }
예제 #5
0
 public ActionResult Delete(int id, CourtModel court)
 {
     _courtServices.DeleteCourt(id);
     return(RedirectToAction("Index"));
 }