// generate view to add new assets public IActionResult Create() { // call AssetTypesManager and get collection of KVP objects var assetTypes = AssetTypesManager.GetAsKeyValuePairs(); // create collection of SelectListItems, then store collection in ViewBag var list = new SelectList(assetTypes, "Value", "Text"); ViewBag.AssetTypeId = list; return(View()); }
public ActionResult Edit(AssetType type) { try { AssetTypesManager.Update(type); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Create(AssetType type) { // if new asset type is successfully added to db, redirect to main page. if not, reload current view try { AssetTypesManager.Add(type); return(RedirectToAction("Search", "Asset")); } catch { return(View()); } }
public ActionResult Create(AssetType assetType) { try { // Call the AssetTypeManager to add AssetTypesManager.Add(assetType); return(RedirectToAction("Create", "Assets")); } catch { return(View()); } }
public IEnumerable GetAssetTypes() { var assetTypes = AssetTypesManager.GetAsKeyValuePairs(); var types = new SelectList(assetTypes, "Value", "Text"); var list = types.ToList(); list.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); return(list); }
// generate a dropdown list populated with asset types protected IEnumerable GetAssetTypes() { //create collection of asset types as select list items var assetTypes = AssetTypesManager.GetAsKeyValuePairs(); var styles = new SelectList(assetTypes, "Value", "Text"); // insert new list item for all asset types at index 0 var list = styles.ToList(); list.Insert(0, new SelectListItem { Text = "All Types", Value = "0" }); return(list); }
// GET: AssetTypes public ActionResult Index() { var assetType = AssetTypesManager.GetAssetTypes(); return(View(assetType)); }
// GET: AssetTypes/Edit/5 public ActionResult Edit(int id) { var assetType = AssetTypesManager.Find(id); return(View(assetType)); }
public FullFieldSelectors(long userID) { assetTypesManager = new AssetTypesManager(); this.userID = userID; }