public ActionResult Index() { ManageAccessViewModel _manageAccessViewModelObj = new ManageAccessViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); string Appid = Request.QueryString["Appid"] != null ? Request.QueryString["Appid"].ToString() : ""; List <ApplicationViewModel> ApplicationList = Mapper.Map <List <Application>, List <ApplicationViewModel> >(_applicationBusiness.GetAllApplication()); foreach (ApplicationViewModel Appl in ApplicationList) { selectListItem.Add(new SelectListItem { Text = Appl.Name, Value = Appl.ID.ToString(), Selected = false }); } _manageAccessViewModelObj.ApplicationList = selectListItem; selectListItem = new List <SelectListItem>(); List <RolesViewModel> RoleList = null; if (Appid != "" && Appid != null) { _manageAccessViewModelObj.AppObjectObj = new AppObjectViewModel(); _manageAccessViewModelObj.AppObjectObj.AppID = Guid.Parse(Appid); RoleList = Mapper.Map <List <Roles>, List <RolesViewModel> >(_rolesBusiness.GetAllAppRoles(Guid.Parse(Appid))); foreach (RolesViewModel Appl in RoleList) { selectListItem.Add(new SelectListItem { Text = Appl.RoleName, Value = Appl.ID.ToString(), Selected = false }); } _manageAccessViewModelObj.RoleList = selectListItem; _manageAccessViewModelObj.RoleID = Guid.Parse(RoleList[0].ID.ToString()); } else { RoleList = Mapper.Map <List <Roles>, List <RolesViewModel> >(_rolesBusiness.GetAllAppRoles(Guid.Empty)); foreach (RolesViewModel Appl in RoleList) { selectListItem.Add(new SelectListItem { Text = Appl.RoleName, Value = Appl.ID.ToString(), Selected = false }); } _manageAccessViewModelObj.RoleList = selectListItem; } return(View(_manageAccessViewModelObj)); }
public string GetAllApplication() { try { List <ApplicationViewModel> appList = Mapper.Map <List <Application>, List <ApplicationViewModel> >(_applicationBusiness.GetAllApplication()); return(JsonConvert.SerializeObject(new { Result = "OK", Records = appList })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } }
public ActionResult Index() { UserViewModel userobj = new UserViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <ApplicationViewModel> ApplicationList = Mapper.Map <List <Application>, List <ApplicationViewModel> >(_applicationBusiness.GetAllApplication()); foreach (ApplicationViewModel Appl in ApplicationList) { selectListItem.Add(new SelectListItem { Text = Appl.Name, Value = Appl.ID.ToString(), Selected = false }); } userobj.ApplicationList = selectListItem; //userobj.RoleList = Mapper.Map<List<Roles>, List<RolesViewModel>>(_rolesBusiness.GetAllAppRoles(null)); return(View(userobj)); }
public ActionResult Index() { if (Request.QueryString["appId"] != null) { string Appid = Request.QueryString["appId"].ToString(); ViewBag.AppID = Appid; } AppObjectViewModel _appObjectViewModelObj = new AppObjectViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <ApplicationViewModel> ApplicationList = Mapper.Map <List <Application>, List <ApplicationViewModel> >(_applicationBusiness.GetAllApplication()); foreach (ApplicationViewModel Appl in ApplicationList) { selectListItem.Add(new SelectListItem { Text = Appl.Name, Value = Appl.ID.ToString(), Selected = false }); } _appObjectViewModelObj.ApplicationList = selectListItem; return(View(_appObjectViewModelObj)); }