Beispiel #1
0
        public async Task <ActionResult> ManageComboItemsforUser(string id)
        {
            if (id.IsNullOrWhiteSpace())
            {
                return(HttpNotFound("id null or whitespace"));
            }
            MyComboItemManager    myComboItemManager    = new MyComboItemManager();
            List <SelectListItem> passingComboItemsList = new List <SelectListItem>();
            var allComboItems = myComboItemManager.GetAllComboItems();

            if (allComboItems.Count == 0)
            {
                return(HttpNotFound("No comboitems available in the system. Create a New Role First!"));
            }
            foreach (var comboitem in allComboItems)
            {
                SelectListItem listItem = new SelectListItem()
                {
                    Text = comboitem.Name, Value = comboitem.Name
                };
                passingComboItemsList.Add(listItem);
            }
            var dictionary = new Dictionary <string, object>();

            dictionary.Add("selectlist", passingComboItemsList);
            dictionary.Add("id", id);

            IEnumerable <SelectListItem> comboItemsIenum =
                myComboItemManager.AllComboItemsToIenumSelectlistItemsForUser(id);

            dictionary.Add("ienum", comboItemsIenum);
            myComboItemManager.DisposeAll();
            return(PartialView(dictionary));
        }
        public int GetTotalComboItems()
        {
            MyComboItemManager myComboItemManager = new MyComboItemManager();
            var count = myComboItemManager.GetAllComboItems().Count;

            myComboItemManager.DisposeAll();
            return(count);
        }