private async Task DeleteAuto(Context context, Model.Auto entity, CancellationToken cancellationToken) { var driver = context.Drivers.Where(q => q.AutoId == entity.Id); context.RemoveRange(driver); var auto = await context.Autos.FirstOrDefaultAsync(q => q.Id == entity.Id, cancellationToken); context.Autos.Remove(auto); await context.SaveChangesAsync(cancellationToken); }
private async Task UpdateAuto(Context context, Model.Auto newAuto, CancellationToken cancellationToken) { context.Update(newAuto); await context.SaveChangesAsync(cancellationToken); }
private async Task CreateAuto(Context context, Model.Auto Auto, CancellationToken cancellationToken) { await context.Autos.AddAsync(Auto, cancellationToken); await context.SaveChangesAsync(cancellationToken); }