Beispiel #1
0
        public async Task <User> DeleteUserAsync(int userId)
        {
            var user = await _dbContext.Users.FindAsync(userId);

            if (user != null)
            {
                _dbContext.Remove(user);
                await _dbContext.SaveChangesAsync();
            }
            return(user);
        }
        public async Task <Contact> DeleteContactAsync(int contactId)
        {
            var contact = await _dbContext.Contacts.FindAsync(contactId);

            if (contact != null)
            {
                _dbContext.Remove(contact);
                await _dbContext.SaveChangesAsync();
            }
            return(contact);
        }
Beispiel #3
0
 public void Delete(T entity)
 {
     _context.Remove(entity);
     Save();
 }