예제 #1
0
        // GET: LessonSection/Create
        public async Task <ActionResult> Create(long id)
        {
            Lesson currentLesson = await _lessonRepositoryAsync.GetByIdAsync(id);

            if (currentLesson.Sections != null && currentLesson.Sections.Count > 0)
            {
                LessonViewModel model = new LessonViewModel
                {
                    Lesson   = currentLesson,
                    Sections = currentLesson.Sections,
                    Section  = new LessonSection
                    {
                        User     = currentLesson.User,
                        LessonId = currentLesson.Id
                    }
                };

                return(View(model));
            }
            else
            {
                LessonViewModel model = new LessonViewModel
                {
                    Lesson  = currentLesson,
                    Section = new LessonSection
                    {
                        User     = currentLesson.User,
                        LessonId = currentLesson.Id
                    }
                };

                return(View(model));
            }
        }
예제 #2
0
 // GET: Lesson/Details/5
 public async Task <ActionResult> Details(int id)
 {
     return(View(await _lessonRepositoryAsync.GetByIdAsync(id)));
 }