Exemple #1
0
 public static void GetAll()
 {
     var dao = new RecursoDao();
     dao.GetAll()
         .ToList<Recurso>()
         .ForEach( x => Console.WriteLine(x) );
 }
Exemple #2
0
        public static void Create()
        {
            var rolDao = new RolDao();
            var recDao = new RecursoDao();

            var recursos = recDao.GetAll();

            var admin = new Rol()
            {
                Nombre = "Administrador",
                PermisosAsignados = new Recurso[] {
                    recursos.ToList<Recurso>().Where( x => x.Id == 1 ).Select(x => x ).First(),
                    recursos.ToList<Recurso>().Where( x => x.Id == 2 ).Select(x => x ).First(),
                    recursos.ToList<Recurso>().Where( x => x.Id == 3 ).Select(x => x ).First(),
                }
            };

            var secre = new Rol()
            {
                Nombre = "Secretaria",
                PermisosAsignados = new Recurso[] {
                    recursos.ToList<Recurso>().Where( x => x.Id == 2 ).Select(x => x ).First(),
                }
            };

            admin = rolDao.Create(admin).Value;
            secre = rolDao.Create(secre).Value;

            Console.WriteLine( admin );
            Console.WriteLine( secre );
        }
 public RecursoController(RecursoDao dao)
     : base()
 {
     this.dao = dao;
 }