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

            var query  = new PredmetQuery(Db);
            var result = await query.FindOneAsync(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutOne([FromBody] Predmet body)
        {
            await Db.Connection.OpenAsync();

            var query  = new PredmetQuery(Db);
            var result = await query.FindOneAsync(body.id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            result.nazev = body.nazev;
            await result.UpdateAsync();

            return(new OkObjectResult(result));
        }