public ActionResult Edit(int id, CourtModel court) { if (!ModelState.IsValid) { return(View()); } _courtServices.Update(id, court); return(RedirectToAction("Index")); }
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")); }
public void Update(int id, CourtModel model) { _courtRepository.Update(id, model.Name); }
// Methods for courts public void Create(CourtModel model) { _courtRepository.Add(model.Name); }
public ActionResult Delete(int id, CourtModel court) { _courtServices.DeleteCourt(id); return(RedirectToAction("Index")); }