public bool AddClubCenter(ClubCenter clubCenter) { try { this.dbContext.ClubCenters.Add(clubCenter); this.dbContext.SaveChanges(); } catch (SqlException sqlException) { return(false); } catch (Exception exception) { return(false); } return(true); }
public bool DeleteClubCenter(ClubCenter clubCenter) { try { var clubCenterToDelete = this.dbContext.ClubCenters.SingleOrDefault(c => c.ClubCenterId == clubCenter.ClubCenterId); this.dbContext.Entry(clubCenterToDelete).State = EntityState.Deleted; this.dbContext.SaveChanges(); } catch (SqlException sqlException) { return(false); } catch (Exception exception) { return(false); } return(true); }