protected IEnumerable GetAssetTypes() { var types = AssetTypeManager.GetAsKeyValuePairs(); var list = new SelectList(types, "Value", "Text"); return(list); }
//Creating new asset public IActionResult Create() { var aType = AssetTypeManager.GetAsKeyValuePairs(); var list = new SelectList(aType, "Value", "Text"); ViewBag.AssetTypeId = list; //Different then GetAssetTypes (I did not want it to show "All" on index 0 while adding new assets) return View(); }
// GET: Assets/Create public ActionResult Create() { // Populate dropdown boxes for asset type var AssetTypes = AssetTypeManager.GetAsKeyValuePairs(); ViewBag.AssetTypes = new SelectList(AssetTypes, "Id", "Name"); return(View()); }
public IActionResult Create() { var types = AssetTypeManager.GetAsKeyValuePairs(); var list = new SelectList(types, "Value", "Text"); ViewBag.AssetTypes = list; return(View()); }
protected IList NoIndexAssetTypes() { // create collection of property types and assign as key value pairs var keyValueTypes = AssetTypeManager.GetAsKeyValuePairs(); var selectListTypes = new SelectList(keyValueTypes, "Value", "Text"); var listTypes = selectListTypes.ToList(); return(listTypes); }
// GET: Asset/Details/5 //public ActionResult Details(int id) //{ // return View(); //} // GET: Asset/Create public ActionResult Create() { //get Asset type from AssetTypeManager. This will populate the dropdown list in the Create page var assetTypes = AssetTypeManager.GetAsKeyValuePairs(); var list = new SelectList(assetTypes, "Id", "Name"); ViewBag.AssetTypeId = list; return(View()); }
//To be used only for dropdown on home page. it has All Types Selection protected IEnumerable GetAssetTypes() { var types = AssetTypeManager.GetAsKeyValuePairs(); var typeList = new SelectList(types, "Value", "Text"); var typeListWithAllTypes = typeList.ToList(); typeListWithAllTypes.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); return(typeListWithAllTypes); }
public IActionResult Index() { var types = AssetTypeManager.GetAsKeyValuePairs(); var assetTypes = new SelectList(types, "Value", "Text"); var list = assetTypes.ToList(); list.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); ViewBag.AssetTypes = list; return(View()); }
//******Filtering by asset type******/// //**Optional** total of selected asset along with the list, (didn't work) //public IActionResult Total(int id) //{ // var filteredAssets = AssetManager.GetAllByAssetType(id); // var result = $"Total Assets: {filteredAssets.Count}"; // return Content(result); //} //Dropdown, innitial index is set to "All" for the main page ONLY protected IEnumerable GetAssetTypes() { var types = AssetTypeManager.GetAsKeyValuePairs(); var names = new SelectList(types, "Value", "Text"); //setting innitial value to "All" var list = names.ToList(); list.Insert(0, new SelectListItem { Text = "All", Value = "0" }); return list; }
protected IEnumerable GetAssetTypes() { //create the collection of asset types select list items var types = AssetTypeManager.GetAsKeyValuePairs(); var names = new SelectList(types, "Value", "Text"); var list = names.ToList(); // to get all types on dropdown and get all the assets on viewcomponent list.Insert(0, new SelectListItem // to add with index of zero i.e specified index use insert instead of add { Text = "All Asset Types", Value = "0" }); return(list); }
protected IEnumerable GetAssetTypes() { //create the collection of property types select list items var types = AssetTypeManager.GetAsKeyValuePairs(); var assetTypes = new SelectList(types, "Value", "Text"); var list = assetTypes.ToList(); list.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); return(list); }
//method to get the asset types as a key value pair //and return as a list to use in the types drop down list protected IEnumerable GetAssetTypes() { var types = AssetTypeManager.GetAsKeyValuePairs(); // call the asset type manager var typesList = new SelectList(types, "Value", "Text"); var list = typesList.ToList(); list.Insert(0, new SelectListItem //insert a new default list item for dropdown list { Text = "All Types", Value = "0" }); return(list); }
protected IList GetAssetTypes() { // create collection of property types and assign as key value pairs var keyValueTypes = AssetTypeManager.GetAsKeyValuePairs(); var selectListTypes = new SelectList(keyValueTypes, "Value", "Text"); var listTypes = selectListTypes.ToList(); // insert all types option to display all assets listTypes.Insert(0, new SelectListItem { Value = "0", Text = "All Types" }); return(listTypes); }
protected IEnumerable GetAssetTypes() { var types = AssetTypeManager.GetAsKeyValuePairs(); var names = new SelectList(types, "Value", "Text"); var list = names.ToList(); //add "all assets" to the list list.Insert(0, new SelectListItem { Text = "All Assets", Value = "0" }); return(list); }
// GET: Assets public ActionResult Index() { var Assets = AssetManager.GetAllAssets(). Select(a => new AssetsViewModel { Id = a.Id, AssetTypes = a.AssetType.Name, Description = a.Description, Manufacturer = a.Manufacturer, Model = a.Model, SerialNumber = a.SerialNumber, TagNumber = a.TagNumber }); // Populate Drop Down list with selection of AssetTypes var AssetTypes = AssetTypeManager.GetAsKeyValuePairs(); ViewBag.AssetTypes = new SelectList(AssetTypes, "Id", "Name"); return(View(Assets)); }
protected IEnumerable GetAssetTypes() { var assettypes = AssetTypeManager.GetAsKeyValuePairs(); //create a collection of SelectListItems var types = new SelectList(assettypes, "Key", "Value"); var list = types.ToList(); list.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); return(list); }