public async Task <IActionResult> Create([Bind("Id,Name,City,Business,TurnOver")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Create([Bind("DepartmentID,Name,CompanyID")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); } //ViewData["CompanyID"] = new SelectList(_context.Company, "CompanyID", "CompanyID", department.CompanyID); //return View(department); //return Redirect("/Departments?=" + department.CompanyID); return(RedirectToAction("Index", "Companies")); }
public async Task <IActionResult> Create([Bind("EmployeeID,LastName,FirstName,Gender,Birthdate,Occupation,DepartmentID")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); } //ViewData["DepartmentID"] = new SelectList(_context.Department, "DepartmentID", "DepartmentID", employee.DepartmentID); //return View(employee); //return Redirect("/Employees?=" + employee.DepartmentID); return(RedirectToAction("Index", "Companies")); }