Пример #1
0
        private FrontPageViewModel GetFrontPageViewModel(PageViewMode?mode)
        {
            var repo         = new PersonalInfoRepository();
            var personalInfo = repo.GetPersonalInfo();

            var eduRepo    = new EducationRepository();
            var educations = eduRepo.GetEducations();

            var expRepo    = new WorkExperienceRepository();
            var experience = expRepo.GetWorkExperience();

            var skillsRepo = new SkillsRepository();
            var skills     = skillsRepo.GetSkills();

            ViewBag.Mode = mode ?? PageViewMode.View;

            var frontPageViewModel = new FrontPageViewModel()
            {
                EducationBlock = new EducationListViewModel()
                {
                    NewEducation = new EducationViewModel()
                },
                WorkExperienceBlock = new WorkExperienceListViewModel()
                {
                    NewWorkExpirience = new WorkExperienceViewModel()
                },
                SkillCategoryBlock = new SkillsCategoryListViewModel()
                {
                    NewSkillCategory = new SkillsCategoryViewModel(),
                }
            };

            frontPageViewModel.PersonalInfo = new PersonalInfoViewModel(personalInfo);

            frontPageViewModel.EducationBlock.EducationList = educations.Select(x => new EducationViewModel(x)).ToList();
            frontPageViewModel.EducationBlock.NewEducation  = new EducationViewModel();

            frontPageViewModel.WorkExperienceBlock.WorkExperienceList = experience.Select(x => new WorkExperienceViewModel(x)).ToList();
            frontPageViewModel.WorkExperienceBlock.NewWorkExpirience  = new WorkExperienceViewModel();

            frontPageViewModel.SkillCategoryBlock.SkillsCategoryList = skills.Select(x => new SkillsCategoryViewModel(x)).ToList();
            frontPageViewModel.SkillCategoryBlock.NewSkillCategory   = new SkillsCategoryViewModel();

            return(frontPageViewModel);
        }
Пример #2
0
        public ActionResult GetSkills()
        {
            var skills = _repository.GetSkills();

            return(View(skills));
        }
Пример #3
0
 /// <summary>
 /// Default route for the skills controller.
 /// </summary>
 public ActionResult Index()
 {
     return(View(_skillsRepository.GetSkills()));
 }