Beispiel #1
0
        public object GetUsersByNameCountrySearch(string name, string countryCode)
        {
            //IEnumerable<KeyValuePair<string, string>> qs = Request.GetQueryNameValuePairs();

            //var name = qs.Where(x => x.Key == "name").Select(x => x.Value).FirstOrDefault();
            //var countryCode = qs.Where(x => x.Key == "countryCode").Select(x => x.Value).FirstOrDefault();

            if (String.IsNullOrEmpty(name))
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            NameCountrySearch nameCountrySearch = new NameCountrySearch
            {
                Name        = name,
                CountryCode = countryCode
            };

            try
            {
                List <User> users = new List <User>();//_ldapService.GetUsersByNameCountrySearch(nameCountrySearch);
                return(users);
            }
            catch (Exception e)
            {
                logger.WarnException("Exception", e);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "JSON Data was malformed"));
            }


            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Beispiel #2
0
        public object GetUsersByNameCountrySearch(string name, string countryCode)
        {
            //IEnumerable<KeyValuePair<string, string>> qs = Request.GetQueryNameValuePairs();

            //var name = qs.Where(x => x.Key == "name").Select(x => x.Value).FirstOrDefault();
            //var countryCode = qs.Where(x => x.Key == "countryCode").Select(x => x.Value).FirstOrDefault();

            if (String.IsNullOrEmpty(name))
                throw new HttpResponseException(HttpStatusCode.BadRequest);

            NameCountrySearch nameCountrySearch = new NameCountrySearch
                {
                    Name = name,
                    CountryCode = countryCode
                };

            try
            {
                List<User> users = new List<User>();//_ldapService.GetUsersByNameCountrySearch(nameCountrySearch);
                return users;

            }
            catch (Exception e)
            {
                logger.WarnException("Exception", e);
                return Request.CreateResponse(HttpStatusCode.BadRequest, "JSON Data was malformed");
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }