public static string FriendlyName(this GroupRoles role)
 {
     return(role switch
     {
         GroupRoles.UserAdmin => "User Admin",
         GroupRoles.UserAdmin_ReadOnly => "User Admin (Read-only)",
         GroupRoles.TaskAdmin => "Request Admin",
         GroupRoles.RequestSubmitter => "Request Submitter",
         _ => role.ToString()
     });
Esempio n. 2
0
        public void Subscribe(int groupId, int userId, GroupRoles role)
        {
            GroupRole          groupRole = dbContext.GroupRoles.Where(r => r.Title == role.ToString()).First();
            ReaderProfileState state     = dbContext.ReaderProfileStates
                                           .Where(s => s.Title == ReaderProfileStates.FullAccess.ToString()).First();
            ReaderProfile profile = new ReaderProfile()
            {
                GroupId              = groupId,
                UserId               = userId,
                GroupRoleId          = groupRole.Id,
                ReaderProfileStateId = state.Id
            };

            dbContext.ReaderProfiles.Add(profile);
            dbContext.SaveChanges();
        }