public async Task <IActionResult> Edit(int id, [Bind("ProjectId,CompanyDepartmentId,CompanyId,ProjectName,ProjectDescription")] Projects projects) { if (id != projects.ProjectId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(projects); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectsExists(projects.ProjectId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "CompanyId", "CompanyId", projects.CompanyId); ViewData["CompanyDepartmentId"] = new SelectList(_context.Department, "CompanyDepartmentId", "Department1", projects.CompanyDepartmentId); return(View(projects)); }
public async Task <IActionResult> Edit(int id, [Bind("CompanyDepartmentId,CompanyId,Department1")] Department department) { if (id != department.CompanyDepartmentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.CompanyDepartmentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "CompanyId", "CompanyId", department.CompanyId); return(View(department)); }