Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,ActivityType,StartDate,EndDate,Description")] Activity activity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(activity);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(activity));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description,StartDate,EndDate")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Add(course);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,UploadTime")] Document document)
        {
            if (ModelState.IsValid)
            {
                _context.Add(document);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(document));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description,StartDate,EndDate,CourseId")] Module @module)
        {
            if (ModelState.IsValid)
            {
                db.Add(@module);
                await db.SaveChangesAsync();

                var moduleFromdb = db.Module.Where(m => m.Title == module.Title && m.StartDate == module.StartDate && m.EndDate == module.EndDate).FirstOrDefault();
                var course       = db.Course.Find(module.CourseId);

                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@module));
        }