public IActionResult EditDepartment(int departmentId, DepartmentViewModel departmentViewModel) { if (!string.IsNullOrEmpty(departmentViewModel.Department.Description)) { departmentViewModel.Department.DepartmentId = departmentId; _DepartmentData.EditDepartment(departmentViewModel.Department); return(RedirectToAction("Index", "Department")); } return(Content("I will try to find a way to add to table ID " + departmentViewModel.Department.DepartmentId + "New Name Name" + departmentViewModel.Department.Description)); }
public IActionResult EditDepartment(int id, Department dept) { var existingDepartment = _departmentData.GetDepartment(id); if (existingDepartment != null) { dept.DeptId = existingDepartment.DeptId; _departmentData.EditDepartment(dept); return(Ok(dept)); } return(NotFound($"Department with the id: {id} was not found")); }