public void editarTramo(DTOTramo tramo, string tokenJWT) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenJWT); var putTask = client.PutAsJsonAsync($"editar/linea/{tramo.IdLinea}/{tramo.IdParada}", tramo); putTask.Wait(); //var result = putTask.Result; } }
public IHttpActionResult editarTramo(int IdLinea, int IdParada, [FromBody] DTOTramo tramo) { try { ETramo t = cAdmin.editarTramo(IdLinea, IdParada, tramo); if (t != null) { return(Ok(t)); } return(Content(HttpStatusCode.NotFound, "El tramo ya existe")); } catch (Exception) { return(NotFound()); } }
public ETramo editarTramo(int IdLinea, int IdParada, DTOTramo tramo) { try { using (uybusEntities db = new uybusEntities()) { Tramo t = db.Tramo.Find(IdLinea, IdParada); t.TiempoEstimado = tramo.TiempoEstimado; t.IdParada = IdParada; t.IdLinea = IdLinea; t.Orden = tramo.Orden; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); return(Converter.tramoAETramo(t)); } } catch (System.Exception ex) { throw ex; } }
public ETramo editarTramo(int IdLinea, int IdParada, DTOTramo tramo) { return(iTramo.editarTramo(IdLinea, IdParada, tramo)); }