示例#1
0
        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);
        }
示例#2
0
        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);
        }