public async Task <IActionResult> GetLatest() { await Db.Connection.OpenAsync(); var query = new TransactionDataQuery(Db); var result = await query.LatestPostsAsync(); return(new OkObjectResult(result)); }
public async Task <IActionResult> DeleteAll() { await Db.Connection.OpenAsync(); var query = new TransactionDataQuery(Db); await query.DeleteAllAsync(); await query.ResetAuto(); return(new OkResult()); }
public async Task <IActionResult> GetOne(int id) { await Db.Connection.OpenAsync(); var query = new TransactionDataQuery(Db); var result = await query.FindOneAsync(id); if (result is null) { return(new NotFoundResult()); //404 Error } return(new OkObjectResult(result)); }
public async Task <IActionResult> PutOne(int id, [FromBody] TransactionData body) { await Db.Connection.OpenAsync(); var query = new TransactionDataQuery(Db); var result = await query.FindOneAsync(id); if (result is null) { return(new NotFoundResult()); //404 Error } result.Time_Stamp = body.Time_Stamp; await result.UpdateAsync(); return(new OkObjectResult(result)); }