public ActionResult <string> DeleteGym(int id) { var deleteGymResponse = _gymRepository.DeleteGym(id); if (deleteGymResponse.IsError) { return(BadRequest(deleteGymResponse.Message)); } return(Ok()); }
public IActionResult Delete(int id) { var gymToDelete = _gymRepository.Gyms.SingleOrDefault(x => x.GymId == id); if (gymToDelete != null) { try { var result = _gymRepository.DeleteGym(id); } catch (Exception e) { Console.WriteLine(e); ViewData["Message"] = "Gym could not be deleted from the database."; } return(View("list", _gymRepository.Gyms)); } return(View("List", _gymRepository.Gyms)); }