public async Task <IActionResult> SaveInformation(vmUserProfile vmEmployeeCreate)
        {
            if (ModelState.IsValid)
            {
                var loggedInEmployeeId = User.GetCurrentEmployeeId(db.Employee);
                var result             = db.Employee.Get(loggedInEmployeeId);
                if (result != null)
                {
                    result.FirstName      = vmEmployeeCreate.FirstName == null ? result.FirstName : vmEmployeeCreate.FirstName;
                    result.LastName       = vmEmployeeCreate.LastName == null ? result.LastName : vmEmployeeCreate.LastName;
                    result.Phone          = vmEmployeeCreate.Phone == null ? result.Phone : vmEmployeeCreate.Phone;
                    result.Email          = vmEmployeeCreate.Email == null ? result.Email : vmEmployeeCreate.Email;
                    result.FatherName     = vmEmployeeCreate.FatherName == null ? result.FatherName : vmEmployeeCreate.FatherName;
                    result.MotherName     = vmEmployeeCreate.MotherName == null ? result.MotherName : vmEmployeeCreate.MotherName;
                    result.PresentAddress = vmEmployeeCreate.PresentAddress == null ? result.PresentAddress : vmEmployeeCreate.PresentAddress;
                    db.Employee.Update(result);
                    db.Save();

                    var currentUser = await _userManager.GetUserAsync(HttpContext.User);

                    currentUser.PhoneNumber          = result.Phone;
                    currentUser.Email                = result.Email;
                    currentUser.EmailConfirmed       = true;
                    currentUser.PhoneNumberConfirmed = true;
                    var updateUser = await _userManager.UpdateAsync(currentUser);

                    return(Json(true));
                }
            }
            return(Json(false));
        }
        public IActionResult Index()
        {
            var loggedInEmployeeId = User.GetCurrentEmployeeId(db.Employee);
            var result             = db.Employee.GetFirstOrDefaultWithRelatedData(e => e.Id == loggedInEmployeeId);

            if (result != null)
            {
                vmUserProfile userProfile = new vmUserProfile();
                userProfile.FullName = result.FullName;
                if (result.JobLocation != null)
                {
                    userProfile.JobLocation = result.JobLocation.Name;
                }
                if (result.Department != null)
                {
                    userProfile.DepartmentName = result.Department.Name;
                }
                if (result.Designation != null)
                {
                    userProfile.Designation = result.Designation.Name;
                }
                if (result.Shift != null)
                {
                    userProfile.ShiftName = result.Shift.Name;
                }

                userProfile.FatherName     = result.FatherName;
                userProfile.MotherName     = result.MotherName;
                userProfile.PresentAddress = result.PresentAddress;

                userProfile.FirstName   = result.FirstName;
                userProfile.LastName    = result.LastName;
                userProfile.Phone       = result.Phone;
                userProfile.Email       = result.Email;
                userProfile.JoiningDate = result.JoinDate.ToShortDateString();
                userProfile.DateOfBirth = result.DateofBirth;
                if (result.PhotoUrl != null)
                {
                    userProfile.PhotoUrl = _imagePath.GetFilePathAsSourceUrl(result.PhotoUrl);
                }
                else
                {
                    userProfile.PhotoUrl = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }

                return(View(userProfile));
            }
            else
            {
                return(RedirectToAction("current", "Employee", new{ Area = "HR" }));
            }
        }