public virtual async Task <T> InsertAsync(T entity) { Context.Add(entity); await Context.SaveChangesAsync(); return(entity); }
private async Task InternalWriteKeyAsync(string id, string value, KeyKind kind) { var key = await _context.CryptoKeys.FirstOrDefaultAsync(c => c.Id == id && c.KindId == kind.Id); if (key == null) { var cryptoKey = new CryptoKey { Id = id, KindId = kind.Id, Value = value }; _context.Add(cryptoKey); } else { key.Value = value; _context.Update(key); } await _context.SaveChangesAsync(); }