public async Task <IActionResult> Create([Bind("Id,Name,Credits")] Module @module) { if (ModelState.IsValid) { _context.Add(@module); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(@module)); }
public async Task <IActionResult> Create([Bind("Id,Name,DepartmentEmail")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("Id,Name,Email")] Lecturer lecturer) { if (ModelState.IsValid) { _context.Add(lecturer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lecturer)); }
public async Task <IActionResult> Create([Bind("Id,DepartmentId,LecturerId,ModuleId")] Allocation allocation) { if (ModelState.IsValid) { _context.Add(allocation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Set <Department>(), "Id", "Id", allocation.DepartmentId); ViewData["LecturerId"] = new SelectList(_context.Set <Lecturer>(), "Id", "Id", allocation.LecturerId); ViewData["ModuleId"] = new SelectList(_context.Set <Module>(), "Id", "Id", allocation.ModuleId); return(View(allocation)); }