public async Task DeleteFile(int fileId) { var user = await userAccess.GetUser(); var file = await dbContext.Files .Include(f => f.Comments) .FirstAsync(f => f.Id == fileId); dbContext.Comments.RemoveRange(file.Comments); await dbContext.SaveChangesAsync(); dbContext.Remove(file); await dbContext.SaveChangesAsync(); logger.LogInformation(user.Id + ": deleted a file!(ID:" + fileId + ")"); }
async Task ICustomerRepository <Customer> .Delete(Customer customer) { var ent = _context.Remove(customer).Entity; await _context.SaveChangesAsync(); }