public async Task <bool> Insert(ResourceSet resourceSet) { _context.ResourceSets.Add(resourceSet.ToModel()); await _context.SaveChangesAsync().ConfigureAwait(false); return(true); }
public async Task <bool> Insert(ResourceSet resourceSet) { using (var transaction = await _context.Database.BeginTransactionAsync().ConfigureAwait(false)) { try { _context.ResourceSets.Add(resourceSet.ToModel()); await _context.SaveChangesAsync().ConfigureAwait(false); transaction.Commit(); return(true); } catch { transaction.Rollback(); return(false); } } }