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)); }
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()); }
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)); }