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)); }
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)); }
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)); }
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)); }