public JsonResult OnPostTypeAheadImplementation(String typedstring, String QueryType)
        {
            if (typedstring == null)
            {
                return(new JsonResult(null));
            }
            String Returned = "";

            try
            {
                Returned = RetrieveServerDataFromStrings(typedstring, QueryType);
            }
            catch (Exception E)
            {
                return(new JsonResult(null));
            }

            List <CardModel> GoodMatches = new List <CardModel>();
            SolrStuff        A           = JsonConvert.DeserializeObject <SolrStuff>(Returned);

            if (!QueryType.Equals("Raw"))
            {
                foreach (CardModel Ad in A.response.docs)
                {
                    if (GoodMatches.Count < 3)
                    {
                        String toTest = getByQueryType(QueryType, Ad).Substring(0, Math.Min(getByQueryType(QueryType, Ad).Length, typedstring.Length));
                        if (toTest.ToUpper().CompareTo(typedstring.ToUpper()) == 0)// || toTest.ToUpper().CompareTo(typedstring.ToUpper()) > 0)
                        {
                            GoodMatches.Add(Ad);
                        }
                    }
                    else
                    {
                        return(new JsonResult(GoodMatches));
                    }
                }
                return(new JsonResult(GoodMatches));
            }
            else
            {
                A.response.docs.Sort(delegate(CardModel AC, CardModel DC)
                {
                    return(AC.name[0].CompareTo(DC.name[0]));
                });
                return(new JsonResult(A.response.docs));
            }
        }
 public void OnPostSearch(String usr, String QueryType)
 {
     if (String.IsNullOrEmpty(usr))
     {
         myModel = new CardSet();
         myModel.SearchItemError = "Invalid Search Entry, please try again.";
     }
     else
     {
         WebClient myClient = new WebClient();
         String    Returned = "";
         try
         {
             Returned = RetrieveServerDataFromStrings(usr, QueryType);
             SolrStuff A = JsonConvert.DeserializeObject <SolrStuff>(Returned);
             myModel = new CardSet(A.response.docs);
         } catch (Exception E)
         {
             myModel.SearchItemError = "Invalid Search Entry, please try again.";
         }
     }
 }