Exemplo n.º 1
0
 public ICollection <Viaje> RegistrarViajes([FromBody] registrarViajeDTO rv)
 {
     try
     {
         return(bla.RegistrarViajes(rv.idHorario, rv.fInicio, rv.fFin, rv.dias));
     }
     catch (Exception e)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message));
     }
 }
        public async Task <ICollection <Viaje> > RegistrarViajes(int idHorario, DateTime fInicio, DateTime fFin, ICollection <DiaSemana> dias)
        {
            try
            {
                registrarViajeDTO rv = new registrarViajeDTO()
                {
                    idHorario = idHorario,
                    fInicio   = fInicio,
                    fFin      = fFin,
                    dias      = dias
                };

                HttpResponseMessage response = await client.PostAsJsonAsync(basicPath + "RegitrarViajes", rv);

                response.EnsureSuccessStatusCode();

                return(await response.Content.ReadAsAsync <ICollection <Viaje> >());
            }
            catch (Exception e)
            {
                throw e;
            }
        }