public async Task <IActionResult> PutEmployee(int id, Employee employee) { if (id != employee.EmployeeId) { return(BadRequest()); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> Create([Bind(Include = "DepartmentID,Name,Budget,StartDate,InstructorID")] Department department) { if (ModelState.IsValid) { db.Departments.Add(department); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName", department.InstructorID); return(View(department)); }