public ActionResult ingresarHF(int id) { DTOLegada lleg = new DTOLegada(); lleg.idViaje = id; return(View(lleg)); }
//public string Baseurl = "https://localhost:44330/conductor/"; public DTOnextBus llegada(DTOLegada llegada, string tokenJWT) { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenJWT); string URLespecial = ConfigurationManager.AppSettings["baseURL"] + "/general/llegada"; var response = client.PostAsJsonAsync(URLespecial, llegada).Result; DTOnextBus returnValue = response.Content.ReadAsAsync <DTOnextBus>().Result; return(returnValue); } }
public IHttpActionResult llegada([FromBody] DTOLegada llegada) { try { if (llegada == null) { return(Content(HttpStatusCode.BadRequest, "No.")); } DTOnextBus res = cGeneral.CrearLlegada(llegada.idViaje, TimeSpan.Parse(llegada.hora), Convert.ToDateTime(llegada.fecha)); return(Ok(res)); } catch (Exception) { return(NotFound()); } }
public ActionResult ingresarHF(DTOLegada llegada) { DTOnextBus siguientes = pxc.llegada(llegada, Session["tokenJWT"].ToString()); string sig = ""; if (siguientes != null) { if (siguientes.matricula != "N/A") { sig = "El ómnibus con matrícula (" + siguientes.matricula + "), Pasara por la parada (" + siguientes.parada + "), a las " + siguientes.hora + " hrs."; var hubContext = GlobalHost.ConnectionManager.GetHubContext <Notificacion>(); hubContext.Clients.All.notificarUsr(sig); } } return(RedirectToAction("lstViajes")); }