Exemple #1
0
        public static bool Delete(int idLocation)
        {
            using (var _dbContext = new serti_dbContext())
            {
                var locationFiltered =
                    _dbContext.Location.FirstOrDefault(_location => _location.Id == idLocation);

                if (locationFiltered == null)
                {
                    return(false);
                }

                _dbContext.Remove(locationFiltered);
                return(_dbContext.SaveChanges() > 0);
            }
        }
Exemple #2
0
        public static bool Delete(int idBook)
        {
            using (var _dbContext = new serti_dbContext())
            {
                var bookFiltered =
                    _dbContext.Book.FirstOrDefault(_book => _book.Id == idBook);

                if (bookFiltered == null)
                {
                    return(false);
                }

                _dbContext.Remove(bookFiltered);
                return(_dbContext.SaveChanges() > 0);
            }
        }