public Role.RoleTypes GetUserRole(int myId) { Role.RoleTypes myRole = Role.RoleTypes.Employee; using (var context = new DbModels()) { var user = context.UserRoles.Where(m => m.userId == myId) .FirstOrDefault(); if (user != null) { var myRoleID = user.roleId; myRole = (Role.RoleTypes)myRoleID; } } return(myRole); }
private Role GetRole(Role.RoleTypes roleType) => new Role(roleType, roleType.ToString());