Ejemplo n.º 1
0
        public HttpResponseMessage GetDropsPaged()
        {
            //Data subscription'ın geçerliliği kontrolü
            if (!IsSubscribedDataService())
            {
                return(Request.CreateResponse(HttpStatusCode.UpgradeRequired, "Renew your data subscription!"));
            }
            //****
            DomainData dd = new DomainData();
            DropDomainModelWebApiPaged DropDomainList = new DropDomainModelWebApiPaged();
            var           ListOfTLDs = Request.Headers.GetValues("ListOfTLDs").FirstOrDefault();
            List <string> TLDs       = JsonConvert.DeserializeObject <List <string> >(ListOfTLDs);

            string IsKeyword      = Request.Headers.GetValues("IsKeyword").FirstOrDefault();
            char   DropOrLastDrop = Convert.ToChar(Request.Headers.GetValues("DropOrLastDrop").FirstOrDefault());
            //for paging+filters
            int    NumOfRecPerPage = Convert.ToInt32(Request.Headers.GetValues("NumOfRecPerPage").FirstOrDefault());
            int    WhichPage       = Convert.ToInt32(Request.Headers.GetValues("WhichPage").FirstOrDefault());
            char   SortBy          = Convert.ToChar(Request.Headers.GetValues("SortBy").FirstOrDefault());
            string SearchStr       = Request.Headers.GetValues("SearchStr").FirstOrDefault();

            //string KeyWord = Request.Headers.GetValues("KeyWord").FirstOrDefault();
            string dropDate = Request.Headers.GetValues("dropDate").FirstOrDefault();
            //****
            //for excel
            bool IsExcel = (Request.Headers.GetValues("IsExcel").FirstOrDefault() == "1")?true:false;

            if (IsKeyword == "0")
            {
                var MatchCriteria = Request.Headers.GetValues("MatchCriteria").FirstOrDefault();
                MatchCriteriaWithPatternModel objMC = JsonConvert.DeserializeObject <MatchCriteriaWithPatternModel>(MatchCriteria);
                DropDomainList = dd.GetFilteredDropingDomainsPaged(objMC, TLDs, DropOrLastDrop, SortBy, SearchStr, NumOfRecPerPage, WhichPage, dropDate, IsExcel);
            }
            if (IsKeyword == "1")
            {
                string IncludeHyphens           = Request.Headers.GetValues("IncludeHyphens").FirstOrDefault();
                string IncludeNumbers           = Request.Headers.GetValues("IncludeNumbers").FirstOrDefault();
                var    Keywords                 = Request.Headers.GetValues("Keywords").FirstOrDefault();
                List <KeywordModel> objKeywords = JsonConvert.DeserializeObject <List <KeywordModel> >(Keywords);
                DropDomainList = dd.GetDropingDomainsByKeywordsPaged(IncludeHyphens, IncludeNumbers, objKeywords, TLDs, DropOrLastDrop, SortBy, SearchStr, NumOfRecPerPage, WhichPage, dropDate, IsExcel);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, DropDomainList));
            //return Request.CreateResponse(HttpStatusCode.OK, HttpContext.Current.User.Identity.Name);
        }