public async Task <IActionResult> Create([Bind("DepartmentID,Name")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(department)); }
public async Task <IActionResult> Create([Bind("TrainingProgramID,Name,Description,StartDate,EndDate,MaxAttendees")] TrainingProgram trainingProgram) { if (ModelState.IsValid) { _context.Add(trainingProgram); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(trainingProgram)); }
public async Task <IActionResult> Create([Bind("ComputerID,Make,Manufacturer,DatePurchased")] Computer computer) { if (ModelState.IsValid) { _context.Add(computer); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(computer)); }
public async Task <IActionResult> Create([Bind("EmployeeID,FirstName,LastName,StartDate,DepartmentID")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["DepartmentID"] = new SelectList(_context.Set <Department>(), "DepartmentID", "Name", employee.DepartmentID); return(View(employee)); }