public async Task <IActionResult> Create([Bind("TrainingId,Title,Description,StartDate,EndDate")] Training training) { if (ModelState.IsValid) { _context.Add(training); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(training)); }
public async Task <IActionResult> Create([Bind("DepartmentId,Name")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("EmployeeId,FirstName,LastName,DepartmentId")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Set <Department>(), "DepartmentId", "Name", employee.DepartmentId); return(View(employee)); }