예제 #1
0
 public RolController(
         RolDao dao
     )
     : base()
 {
     this.dao = dao;
 }
예제 #2
0
 public static void Delete()
 {
     var dao = new RolDao();
     GetAll();
     dao.Delete( 2 );
     GetAll();
 }
예제 #3
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 );
        }
예제 #4
0
 public static void Update()
 {
     var dao = new RolDao();
     var secre = dao.Get(2).Value;
     secre.Nombre = "Secretaria Updated";
     secre = dao.Update(secre).Value;
     Console.WriteLine(secre);
 }
예제 #5
0
 public static void GetAll()
 {
     var dao = new RolDao();
     dao.GetAll().ToList<Rol>().ForEach(x => Console.WriteLine(x));
 }
예제 #6
0
 public static void Get()
 {
     var dao = new RolDao();
     Console.WriteLine(dao.Get(2).Value);
 }