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; }
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; }