public async Task <ActionResult> GetOne(int id) { await MySqlDatabase.Connection.OpenAsync(); var query = new CloudItemQuery(MySqlDatabase); var result = await query.FindOneAsync(id); await MySqlDatabase.Connection.CloseAsync(); if (result is null) { return(new NotFoundResult()); } return(new OkObjectResult(result)); }
public async Task <IActionResult> DeleteOne(int id) { await MySqlDatabase.Connection.OpenAsync(); var query = new CloudItemQuery(MySqlDatabase); var result = await query.FindOneAsync(id); if (result is null) { return(new NotFoundResult()); } await result.DeleteAsync(); await MySqlDatabase.Connection.CloseAsync(); return(new OkResult()); }