Esempio n. 1
0
        public List<Title> GetTitles(string searchstring)
        {
            
             
            var titles = (from t in db.Titles 
                         select t);

            if (!String.IsNullOrEmpty(searchstring))
            {
                
                titles = titles.Where(t => t.Titl.ToUpper().Contains(searchstring.ToUpper())).Take(10);
                titles = titles.OrderByDescending(t => t.Titl);            
            }
            //if (String.IsNullOrEmpty(searchstring))
            //{
            //    Title t = new Title();
            //    t.Titl = "no title is selected";
            //    suggestedTitlesList.Add(t);
            //}
           
         
            foreach (Title gvTitle in titles)
            {
                Title myTitle = new Title();
                myTitle.TitleID = gvTitle.TitleID;
                myTitle.Titl = gvTitle.Titl;
                myTitle.NocCode = gvTitle.NocCode;
                suggestedTitlesList.Add(myTitle);
            }

            


            if (suggestedTitlesList == null)
            {
                return null;
            }
            return suggestedTitlesList;


        }
Esempio n. 2
0
        public ActionResult GetTenTitles(string searchStringClient)
        {
            GovDbBusinessLayer gv = new GovDbBusinessLayer();
            List<Title> titleList = gv.GetTitles(searchStringClient);
            if (String.IsNullOrEmpty(searchStringClient))
            {
                Title t = new Title();
                t.Titl = "no title is selected";
                titleList.Add(t);
            }

            return Json(titleList, JsonRequestBehavior.AllowGet);
        }