Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,StartDate,Description")] Course course)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddEntityAsync(course);

                await _repository.SaveAllAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] ActivityType activityType)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddEntityAsync(activityType);

                await _repository.SaveAllAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(activityType));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,StartDate,EndDate,Description,CourseId")] Module module)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddEntityAsync(module);

                await _repository.SaveAllAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Courses, "Id", "Name", module.CourseId);
            return(View(module));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,StartDate,EndDate,Description,ModuleId,ActivityTypeId")] LMSActivity lMSActivity)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddEntityAsync(lMSActivity);

                await _repository.SaveAllAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ActivityTypeId"] = new SelectList(_context.ActivityTypes, "Id", "Name", lMSActivity.ActivityTypeId);
            ViewData["ModuleId"]       = new SelectList(_context.Modules, "Id", "Name", lMSActivity.ModuleId);
            return(View(lMSActivity));
        }