Beispiel #1
0
        internal static JournalIndexViewModel ToIndexViewModel(IEnumerable <JournalEntry> journalEntries)
        {
            var vm = new JournalIndexViewModel();

            foreach (var journalEntry in journalEntries)
            {
                vm.JournalEntries.Add(JournalEntryMapper.ToIndexItemViewModel(journalEntry));
            }

            return(vm);
        }
Beispiel #2
0
        public static MvcHtmlString RenderJournalIndex(this HtmlHelper helper, JournalIndexViewModel model)
        {
            StringBuilder builder = new StringBuilder();

            if (model.NotUpdatedCourses.ToList().Count > 0)
            {
                builder.Append(helper.Partial("_NotUpdatedCourses", model.NotUpdatedCourses));
                builder.Append("<br />");
            }
            return(MvcHtmlString.Create(builder.ToString()));
        }
Beispiel #3
0
        public ActionResult Index()
        {
            var userId = User.Identity.GetUserId();
            var isUpdatedCoursesDto       = _courseService.GetTeacherIsUpdatedCourses(userId);
            var isUpdatedCoursesViewModel = _mapper.Map <List <CourseViewModel> >(isUpdatedCoursesDto);

            var notUpdatedCoursesDto       = _courseService.GetTeacherNotUpdatedCourses(userId);
            var notUpdatedCoursesViewModel = _mapper.Map <List <CourseViewModel> >(notUpdatedCoursesDto);

            var journalViewModel = new JournalIndexViewModel()
            {
                IsUpdatedCoursesViewModels = isUpdatedCoursesViewModel,
                NotUpdatedCourses          = notUpdatedCoursesViewModel
            };


            return(View(journalViewModel));
        }