예제 #1
0
        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));
        }
예제 #2
0
        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));
        }