public RolController( RolDao dao ) : base() { this.dao = dao; }
public static void Delete() { var dao = new RolDao(); GetAll(); dao.Delete( 2 ); GetAll(); }
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 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); }
public static void GetAll() { var dao = new RolDao(); dao.GetAll().ToList<Rol>().ForEach(x => Console.WriteLine(x)); }
public static void Get() { var dao = new RolDao(); Console.WriteLine(dao.Get(2).Value); }