public IActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var helpers = new SelectDetails();

            var getUser         = _personalService.GetById((int)id);
            var departmantItems = helpers.GetDepartmantItems(getUser, _departmantService);
            var managerItems    = helpers.GetManagerItems(getUser, _managerService);
            var username        = _userService.GetUserId(getUser.ManagerId).Username;

            if (getUser != null)
            {
                var departmantInfo = _departmantService.GetById(getUser.DepartmantId);
                var managerInfo    = _managerService.GetById(getUser.ManagerId);

                var personalDetail = new PersonalDetailView
                {
                    Personal    = getUser,
                    Departmant  = departmantInfo,
                    Manager     = managerInfo,
                    Departmants = departmantItems,
                    Managers    = managerItems,
                    isDisabled  = username == User.Identity.Name ? true : false
                };

                return(View(personalDetail));
            }

            ViewBag.userNotFound = "User is not exist";
            return(View());
        }
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var department      = _departmantService.GetById((int)id);
            var departmentCount = _personalService.GetAllByDepartmentId((int)id).Count;

            if (department == null)
            {
                return(NotFound());
            }

            if (departmentCount >= 1)
            {
                return(RedirectToAction("Index", "Departmans"));
            }

            _departmantService.Delete((int)id);
            return(RedirectToAction("Index", "Departmans"));
        }