public virtual ActionResult EditEmployee(int id)
        {
            var employee = _hmUnitOfWork.EmployeeRepository.GetSingle(id);

            if (employee == null)
            {
                return Json(new { success = false, message = "Employee is not found." });
            }

            var currentHolidayInformation = employee.HolidayInformations.SingleOrDefault(x => x.Year == DateTime.Now.Year);

            var employeeVM = new EmployeeViewModel
            {
                Id = employee.Id,
                FirstName = employee.FirstName,
                LastName = employee.LastName,
                EmailAddress = employee.EmailAddress,
                HireDate = employee.HireDate,
                TeamId  = employee.TeamId,
                Teams = new SelectList(_hmUnitOfWork.TeamRepository.GetAll(), "Id", "Name"),
                DaysAvailable = currentHolidayInformation != null ? currentHolidayInformation.DaysAvailable : (int?)null
            };

            var json = new
            {
                success = true,
                content = base.RenderRazorViewToString(MVC.Management.Views._Employee, employeeVM)
            };

            return Json(json, JsonRequestBehavior.AllowGet);
        }
        public virtual ActionResult EditEmployee(EmployeeViewModel employeeVM)
        {
            if (!ModelState.IsValid)
            {
                return Json(new { success = false, message = "Data is not valid." });
            }

            var employee = _hmUnitOfWork.EmployeeRepository.GetSingle(employeeVM.Id);

            if (employee == null)
            {
                return Json(new { success = false, message = "Employee is not found." });
            }

            employee.FirstName = employeeVM.FirstName;
            employee.LastName = employeeVM.LastName;
            employee.EmailAddress = employeeVM.EmailAddress;
            employee.HireDate = employeeVM.HireDate;
            employee.TeamId = employeeVM.TeamId;

            var currentHolidayInformation = employee.HolidayInformations.SingleOrDefault(x => x.Year == DateTime.Now.Year);

            if (currentHolidayInformation == null)
            {
                currentHolidayInformation = new HolidayInformation
                {
                    DaysAvailable = employeeVM.DaysAvailable.Value,
                    Employee = employee
                };

                _hmUnitOfWork.HolidayInformationRepository.Add(currentHolidayInformation);
            }
            else
                currentHolidayInformation.DaysAvailable = employeeVM.DaysAvailable.Value;

            _hmUnitOfWork.Save();

            return Json(new { success = true });
        }