public async Task <IActionResult> EditDepartments(EditDepartmentFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.hrService.AddManagerDepartmentAsync(model.Id, model.Description, model.ManagerId);

            TempData.AddSuccessMessage($"The '{model.Title} Department' was updated successfully!");

            return(RedirectToAction(
                       nameof(HRController.Departments),
                       "HR",
                       new { area = $"{AdminConstants.HR_AREA}", page = 1 }));
        }
        public async Task <IActionResult> EditDepartments(int id)
        {
            var managers = await this.GetManagersAsync();

            var department = await this.hrService.GetDepartmentById(id);

            var employees = await this.hrEmpService.GetEmployeesInDepartmentAsync(id);

            var currentManagerDepartment = department.Manager;

            var model = new EditDepartmentFormModel
            {
                Id          = department.Id,
                Title       = department.Title,
                Manager     = currentManagerDepartment,
                Description = department.Description,
                Managers    = managers,
                Staff       = employees
            };

            return(View(model));
        }