public bool DeleteSport(Sport sport) { if (SportsList().Any(a => a.Name == sport.Name)) { _sportRepository.DeleteSport(sport); return(true); } return(false); }
// DELETE: api/Sport/5 public HttpResponseMessage Delete(int id) { HttpResponseMessage response; if (id <= 0) { response = Request.CreateResponse(HttpStatusCode.NoContent, "Invalid Id Passed."); return(response); } bool isDeleted = _iSportRepository.DeleteSport(id); if (isDeleted) { response = Request.CreateResponse(HttpStatusCode.OK, "Sport successfully deleted."); } else { response = Request.CreateResponse(HttpStatusCode.Conflict, "Invalid Sport Id."); } return(response); }
public void DeleteSport(int id) { _repository.DeleteSport(id); }
public async Task DeleteSport(int id) { var sport = await _sportRepository.GetSport(id); await _sportRepository.DeleteSport(sport); }