public Task Create(SettingsEntity entity) { if (String.IsNullOrWhiteSpace(entity.Id)) { entity.Id = Guid.NewGuid().ToString(); } _entities.Add(entity); return Task.FromResult(true); }
public async Task Create(SettingsEntity entity) { using(var connection = await _connectionService.OpenConnectionAsync()) { await connection.ExecuteAsync("INSERT INTO settingsschemas(id, displayname, schema, context) VALUES (@Id, @DisplayName, @Schema::json, @Context)", new { entity.Id, entity.DisplayName, Schema = JsonConvert.SerializeObject(entity.Schema), Context = "" }); } }
public async Task Update(string id, SettingsEntity entity) { using(var connection = await _connectionService.OpenConnectionAsync()) { await connection.ExecuteAsync("UPDATE settingsschemas SET id=@Id, displayname=@DisplayName, schema=@Schema::json, context=@Context WHERE id = @OriginalId", new { OriginalId = id, entity.DisplayName, entity.Id, Schema = JsonConvert.SerializeObject(entity.Schema), Context = "" }); } }
public Task Update(string id, SettingsEntity entity) { throw new NotImplementedException(); }