Beispiel #1
0
        public int ObtainId(string name)
        {
            DataContext   context    = new DataContext();
            RolRepository repository = new RolRepository(context);
            var           AllRols    = repository.GetAll();
            var           id         = (from r in AllRols
                                        where r.Name == name
                                        select r.Id).FirstOrDefault();

            return(id);
        }
Beispiel #2
0
        public static List <Rol> AllRolTolist()
        {
            DataContext   context    = new DataContext();
            RolRepository repository = new RolRepository(context);
            var           AllRols    = repository.GetAll();
            var           list       = (from r in AllRols
                                        select new Rol
            {
                Id = r.Id,
                Name = r.Name,
                Details = r.Details,
            }).ToList();

            return(list);
        }