コード例 #1
0
ファイル: Concept.cs プロジェクト: MikhailGogolushko/lmsystem
 public Concept(String name, User author, Subject subject, Boolean isGroup, Boolean published)
 {
     Name = name;
     Author = author;
     Subject = subject;
     IsGroup = isGroup;
     Published = published;
     UserId = author.Id;
     SubjectId = subject.Id;
 }
コード例 #2
0
        private static IEnumerable<User> GetRecipientsList(User currentUser)
        {
            var recipientsList = new List<User>();
            if (currentUser != null
                && currentUser.Membership != null
                && currentUser.Membership.Roles != null
                && currentUser.Membership.Roles.Any())
            {
                var role = currentUser.Membership.Roles.Select(r => r.RoleName).ToArray().First();

                using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
                {
                    switch (role)
                    {
                        case Constants.Roles.Student:
                            recipientsList = repositoriesContainer.UsersRepository
                            .GetAll(new Query<User>(u => u.Lecturer != null)
                            .Include(u => u.Lecturer)).ToList();
                            break;
                        case Constants.Roles.Lector:
                            recipientsList = repositoriesContainer.UsersRepository
                            .GetAll(new Query<User>(u => u.Lecturer != null || u.Student != null)
                            .Include(u => u.Student).Include(u => u.Lecturer)).ToList();
                            break;
                        case Constants.Roles.Admin:
                            recipientsList = repositoriesContainer.UsersRepository
                            .GetAll(new Query<User>(u => u.Id != currentUser.Id)
                            .Include(u => u.Student).Include(u => u.Lecturer)).ToList();
                            break;
                    }
                }
            }

            return recipientsList;
        }
コード例 #3
0
        public ResetPasswordViewModel(User user)
        {
            FullName = user.Student != null ? user.Student.FullName : user.Lecturer.FullName;

              Login = user.UserName;
        }