Exemple #1
0
        public async Task <IActionResult> GetOne(int id)
        {
            await Db.Connection.OpenAsync();

            var query  = new OwnerQuery(Db);
            var result = await query.GetOne(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
Exemple #2
0
        public async Task <IActionResult> PutOne(int id, [FromBody] Owner body)
        {
            await Db.Connection.OpenAsync();

            var query  = new OwnerQuery(Db);
            var result = await query.GetOne(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            result.firstName = body.firstName;
            result.lastName  = body.lastName;
            await result.UpdateOne();

            return(new OkObjectResult(result));
        }