public List <Roles> GetAllRoles() { List <Roles> roles = new List <Roles>(); using (_ctx = new GuildCarsEntities()) { try { var list = _ctx.GetAllRoles(); foreach (var role in list) { Roles addRole = new Roles(); addRole.RoleId = role.Id; addRole.RoleName = role.Name; roles.Add(addRole); } } catch (Exception ex) { throw ex; } } return(roles); }