Beispiel #1
0
        // GET: FindSuggetion
        public ActionResult Index()
        {
            ContactSuggestions objContact = GetContact();

            if (objContact != null)
            {
                ViewBag.ContactComments = objContact.ContactComments;
                ViewBag.Comments        = objContact.Comments;
                if (TempData["Success"] == null)
                {
                    TempData["Success"] = null;
                }
                FillCategoryDrodown();
                DataTable   dtContact      = new DataTable();
                UserDetails objUserDetails = new UserDetails();
                Category    objCategory    = new Category();

                dtContact = objUserDetails.GetAllSuggestionCategoryWise();
                IList <Category> items = dtContact.AsEnumerable().Select(row =>
                                                                         new Category
                {
                    CatId         = row.Field <int>("CatId"),
                    Name          = row.Field <string>("Name"),
                    SubCategories = GetAllSubCate(row.Field <int>("CatId"))
                }).ToList();

                // var list = new SelectList(items, "CatId", "Name");
                objContact.Categories = items;
            }
            if (objContact != null)
            {
                return(View(objContact));
            }

            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }