Пример #1
0
        public static async Task <List <Evenement> > GetEvenements(Int32?_TypologieId = null)
        {
            var _Client = new HttpClient();

            _Client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");

            EvenementsSearchParameters _Parameters = new EvenementsSearchParameters();

            _Parameters.TypologieId = _TypologieId;

            HttpContent        _JsonRequestContent = new StringContent(_Parameters.ToSerializedJson(), Encoding.UTF8, "application/json");
            HttpRequestMessage _Request            = new HttpRequestMessage
            {
                RequestUri = new Uri(Constants.WS_URL + "/Evenements/GetEvenements"),
                Method     = HttpMethod.Post,
                Headers    = { { "APIKey", Constants.WS_PASSKEY } },
                Content    = _JsonRequestContent
            };

            HttpResponseMessage _Response = _Client.SendAsync(_Request).Result;
            String _JsonResponseContent   = await _Response.Content.ReadAsStringAsync();

            List <Evenement> _Evenements = JsonConvert.DeserializeObject <List <Evenement> >(_JsonResponseContent);

            return(_Evenements);
        }
Пример #2
0
 public IHttpActionResult GetEvenements(EvenementsSearchParameters _Parameters)
 {
     return(Ok(EvenementsManager.GetEvenements(
                   _Id: _Parameters.Id,
                   _Libelle: _Parameters.Libelle,
                   _DtMin: _Parameters.DtMin,
                   _DtMax: _Parameters.DtMax,
                   _TypologieId: _Parameters.TypologieId,
                   _EvenementParentId: _Parameters.EvenementParentId,
                   _EleveId: _Parameters.EleveId,
                   _OnlyParentsYN: _Parameters.OnlyParentsYN,
                   _Top: _Parameters.Top
                   )));
 }