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

            var query  = new Ruta(Db);
            var result = await query.FindOne(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteOne(int id)
        {
            await Db.Connection.OpenAsync();

            var query  = new Ruta(Db);
            var result = await query.FindOne(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            await result.DeleteOneAsync();

            return(new OkResult());
        }
Esempio n. 3
0
        public async Task <IActionResult> UpdateParada(int id, [FromBody] Ruta body)
        {
            await Db.Connection.OpenAsync();

            var query  = new Ruta(Db);
            var result = await query.FindOne(id);

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

            return(new OkObjectResult(result));
        }