Ejemplo n.º 1
0
        public List <RolDomainModel> GetRoles()
        {
            List <RolDomainModel> rolDomainModels = new List <RolDomainModel>();
            List <Rol>            rols            = new List <Rol>();

            rols = rolRepository.GetAll().ToList();

            foreach (Rol item in rols)
            {
                RolDomainModel rolDomainModel = new RolDomainModel();

                rolDomainModel.Id     = item.Id;
                rolDomainModel.Nombre = item.Nombre;

                rolDomainModels.Add(rolDomainModel);
            }

            RolDomainModel rolDomainModel1 = new RolDomainModel();

            rolDomainModel1.Id     = 0;
            rolDomainModel1.Nombre = "Seleccionar";

            rolDomainModels.Insert(0, rolDomainModel1);

            return(rolDomainModels);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// gets the home of roles module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            RolRepository objrol = new RolRepository(SessionCustom);

            return(this.View(new Roles()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                CollRols = objrol.GetAll(),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CurrentLanguage = CurrentLanguage
            }));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Este metodo se encarga de consultar todos los roles de un movilizador sin incluir el rol de administrador o super administrador
        /// </summary>
        /// <returns>una lista de roles sin incluier el rol de administrador y super administrador</returns>
        public List <RolDomainModel> ObtenerRolesMovilizador()
        {
            List <RolDomainModel> roles      = new List <RolDomainModel>();
            List <Rol>            totalRoles = rolRepository.GetAll().Where(p => p.Nombre != "Administrador").ToList <Rol>();

            foreach (var item in totalRoles)
            {
                if (item.Nombre != "Super Administrador")
                {
                    RolDomainModel rolDM = new RolDomainModel();
                    rolDM.Id     = item.Id;
                    rolDM.Nombre = item.Nombre;
                    roles.Add(rolDM);
                }
            }
            RolDomainModel rolDomainModelBase = new RolDomainModel();

            rolDomainModelBase.Id     = 0;
            rolDomainModelBase.Nombre = "Seleccionar";
            roles.Insert(0, rolDomainModelBase);
            return(roles);
        }
Ejemplo n.º 4
0
        public IEnumerable <Rol> GetAll()
        {
            var roles = new List <Rol>();

            roles.Add(new Rol {
                Id = 0, Nombre = "- No Especificado -"
            });

            var repository = new RolRepository();

            repository.GetAll().ToList().ForEach(roles.Add);

            return(roles);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// obtains the user detail
        /// </summary>
        /// <param name="id">identifier of user</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            UserRepository    objUser    = new UserRepository(SessionCustom);
            RolRepository     objrol     = new RolRepository(SessionCustom);
            RolUserRepository objuserrol = new RolUserRepository(SessionCustom);

            if (id != null)
            {
                objuserrol.Entity.UserId = objUser.Entity.UserId = id;
                objUser.Load();
                ViewBag.id = id;
            }

            return(this.View(new Usuarios()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollRols = objrol.GetAll(),
                UserCustom = objUser.Entity,
                CollUserrol = id != null ? objuserrol.GetAllReadOnly() : null,
                CurrentLanguage = CurrentLanguage
            }));
        }
Ejemplo n.º 6
0
 public ActionResult GridViewAllPartial()
 {
     return(PartialView("_GridViewAllPartial", objectRepository.GetAll().ToList()));
 }
 public IHttpActionResult GetAllRoles()
 {
     return(Ok(_rolRepository.GetAll()));
 }
 public List <Rol> GetAll()
 {
     return(rolRepository.GetAll());
 }