public async Task UpdateAsync(DistancePointsTable table, params DistancePoints[] points) { using (var transaction = context.BeginTransaction(IsolationLevel.Serializable)) try { foreach (var p in table.Points.ToList()) { context.DistancePoints.Remove(p); } await context.SaveChangesAsync(); foreach (var p in points) { table.Points.Add(p); } await context.SaveChangesAsync(); transaction.Commit(); } catch (Exception) { transaction.Rollback(); throw; } }
public async Task RemoveAsync(DistancePointsTable table) { context.DistancePointsTables.Remove(table); await context.SaveChangesAsync(); }
public async Task AddAsync(DistancePointsTable table) { table.Id = Guid.NewGuid(); context.DistancePointsTables.Add(table); await context.SaveChangesAsync(); }