Пример #1
0
        public async Task <bool> DeleteUser(long Id)
        {
            var delete = await _schoolHubDbContext.User.FirstOrDefaultAsync(s => s.Id == Id);

            if (delete != null)
            {
                _schoolHubDbContext.Remove(delete);
                return(true);
            }
            return(false);
        }
Пример #2
0
        public async Task <bool> DeleteSubject(long Id)
        {
            if (Id < 1)
            {
                throw new ArgumentNullException(nameof(Id));
            }
            var retrieveSubject = await _schoolHubDbContext.Subject.FirstOrDefaultAsync(s => s.Id == Id);

            if (retrieveSubject != null)
            {
                _schoolHubDbContext.Remove(retrieveSubject);
                await _schoolHubDbContext.SaveChangesAsync();

                return(true);
            }
            return(false);
        }