Exemplo n.º 1
0
        public RoleViewModel getRoleFromId(string id)
        {
            var db = new BwareContext();
            var roleViewModel = new RoleViewModel();

            roleViewModel = db.AspNetRoles.Where(r => r.Name == id).Select(r => new RoleViewModel() { CurrentName = r.Name }).FirstOrDefault();
            return roleViewModel;
        }
Exemplo n.º 2
0
        public IEnumerable<RoleViewModel> getRoleViewModelList()
        {
            var db = new BwareContext();
            var roleViewModelList = new List<RoleViewModel>();

            // get all role names and map to our view model with select
            roleViewModelList = db.AspNetRoles.Select(r => new RoleViewModel() { CurrentName = r.Name, NewName = "" }).ToList();
            return roleViewModelList;
        }