public IActionResult AssignApp(SelectedAppViewModel apps) { string uname = ""; foreach (var claim in User.Claims) { if (claim.Type == "name") { uname = claim.Value; break; } } apps.AppList = PopulateApps(uname); if (apps.SelectedAppId != null) { var selectedItems = apps.AppList.Where(p => apps.SelectedAppId.Contains(int.Parse(p.Value))).ToList(); ViewBag.Message = "Selected Apps:"; foreach (var selectedItem in selectedItems) { ViewBag.Message += "\\n" + selectedItem.Text; } } return(View(apps)); }
public IActionResult NewApp(SelectedAppViewModel model) { try { if (ModelState.IsValid) { var apps = string.Join(",", model.SelectedAppId); model.App.appid = apps; return(RedirectToAction("Index")); } return(View()); } catch (Exception ex) { throw ex; } }
public IActionResult AssignApp() { string uname = ""; foreach (var claim in User.Claims) { if (claim.Type == "name") { uname = claim.Value; break; } } SelectedAppViewModel myapps = new SelectedAppViewModel(); myapps.AppList = PopulateApps(uname); string username = (string)TempData["username"]; TempData["User"] = username; return(View(myapps)); }