Example #1
0
        public IActionResult GetThemeMarksByUserId(long userId)
        {
            var listDto = _themeMarkService.GetThemeMarksByUserId(userId);
            var list    = _mapper.Map <IList <ThemeMarkViewModel> >(listDto);

            return(PartialView(list));
        }
Example #2
0
        public IActionResult DashBoard()
        {
            var  userListProfile = new UserProfileListViewModel();
            var  person          = new UserProfileViewModel();
            long currentId       = Convert.ToInt32(_signInManager.UserManager.GetUserId(User));
            var  currentUserDto  = _userService.GetUserById(currentId);

            person.PersonalData = _mapper.Map <UserDetailedViewModel>(currentUserDto);

            var modulesDto = _moduleService.GetModules();
            var modules    = _mapper.Map <IList <ModuleViewModel> >(modulesDto);
            var themesDto  = _themeService.GetThemes();
            var themes     = _mapper.Map <IList <ThemeViewModel> >(themesDto);

            person.Modules = modules;
            person.Themes  = themes;

            var marks = new MarksViewModel();

            if (User.IsInRole("Intern"))
            {
                var themeMarksDto = _themeMarkService.GetThemeMarksByUserId(currentId);
                marks.ThemeMarks = _mapper.Map <IList <ThemeMarkViewModel> >(themeMarksDto);
                var examMarksDto = _examMarkService.GetExamMarksByUserId(currentId);
                marks.ExamMarks             = _mapper.Map <IList <ExamMarkViewModel> >(examMarksDto);
                person.Marks                = marks;
                userListProfile.UserProfile = person;

                return(View("../DashBoard/Index", userListProfile));
            }
            else if (User.IsInRole("Menthor") || User.IsInRole("Admin"))
            {
                var themeMarksDto = _themeMarkService.GetThemeMarks();
                marks.ThemeMarks = _mapper.Map <IList <ThemeMarkViewModel> >(themeMarksDto);
                var examMarksDto = _examMarkService.GetExamMarks();
                marks.ExamMarks = _mapper.Map <IList <ExamMarkViewModel> >(examMarksDto);

                person.Marks = marks;

                if (User.IsInRole("Admin"))
                {
                    var usersDto = _userService.GetUsersDetails();

                    userListProfile.UserProfile = person;
                    userListProfile.Users       = _mapper.Map <IList <UserDetailedViewModel> >(usersDto);

                    return(View("../DashBoard/Index", userListProfile));
                }

                userListProfile.UserProfile = person;
                return(View("../DashBoard/Index", userListProfile));
            }
            return(View("Error"));
        }