Ejemplo n.º 1
0
        public IEnumerable <SelectListItem> GetScreen(int?ScreenID)
        {
            List <ScreenAccess_VM>       query = new UserRoleRepository().GetScreen(null);
            IEnumerable <SelectListItem> list;

            if (ScreenID != null && ScreenID > 0)
            {
                list = query.Select(x => new SelectListItem()
                {
                    Text = x.ScreenName, Value = x.ScreenID.ToString(), Selected = (x.UserRoleID == ScreenID ? true : false)
                }).ToList();
            }
            else
            {
                list = query.Select(x => new SelectListItem()
                {
                    Text = x.ScreenName, Value = x.ScreenID.ToString()
                }).ToList();
            }
            return(list);
        }
Ejemplo n.º 2
0
        public IEnumerable <SelectListItem> GetUserRole(short?UserRoleID)
        {
            List <UserRole_VM>           query = new UserRoleRepository().GetData(null);
            IEnumerable <SelectListItem> list;

            if (UserRoleID != null && UserRoleID > 0)
            {
                list = query.Select(x => new SelectListItem()
                {
                    Text = x.UserRoleName, Value = x.UserRoleID.ToString(), Selected = (x.UserRoleID == UserRoleID ? true : false)
                }).ToList();
            }
            else
            {
                list = query.Select(x => new SelectListItem()
                {
                    Text = x.UserRoleName, Value = x.UserRoleID.ToString()
                }).ToList();
            }
            return(list);
        }