public void UpdateEmployee(RegisterViewModel model)
        {
            using (var employee = new EmployeeRepository())
            {
                Employees emp = employee.GetById(model.UserProfileId);
                if (emp != null)
                {
                    emp.ContactNumber = model.ContactNumber;
                    emp.FirstName = model.FirstName;
                    emp.LastName = model.LastName;
                    emp.PhysicalAddress = model.PhysicalAddress;
                    emp.Position = model.Position;
                    emp.Email = model.Email;
                    emp.Gender = model.Gender;
                    emp.IdentityNumber = model.IdentityNumber;
                    emp.IsFirstTimeLogin = model.IsFirstTimeLogin;

                    employee.Update(emp);
                }
            }
        }
 public RegisterViewModel GetEmployeeById(int id)
 {
     using (var employeeRep = new EmployeeRepository())
     {
         Employees emp = employeeRep.GetById(id);
         var empView = new RegisterViewModel();
         if (emp != null)
         {
             empView.UserProfileId = emp.UserProfileId;
             empView.Position = emp.Position;
             empView.ContactNumber = emp.ContactNumber;
             empView.Email = emp.Email;
             empView.FirstName = emp.FirstName;
             empView.Gender = emp.Gender;
             empView.IdentityNumber = emp.IdentityNumber;
             empView.LastName = emp.LastName;
             empView.PhysicalAddress = emp.PhysicalAddress;
             empView.IsFirstTimeLogin = emp.IsFirstTimeLogin;
         }
         return empView;
     }
 }
        public RegisterViewModel GetEmployeeNames(string userId)
        {
            using (var employee = new EmployeeRepository())
            {
                ApplicationUser appUser = _db.Users.Find(userId);
                var emp = employee.GetById(appUser.UserProfile.UserProfileId);
                var empView = new RegisterViewModel();
                if (emp != null)
                {
                    empView.FirstName = emp.FirstName;
                    empView.LastName = emp.LastName;
                    empView.Position = emp.Position;
                }
                return empView;

            }
        }
        public void DeleteEmployee(int id)
        {
            using (var employeeRep = new EmployeeRepository())
            {
                Employees emp = employeeRep.GetById(id);
                var user = _db.Users.Find(id);
                if (user.Id != null)
                {
                    _db.Users.Remove(user);
                    employeeRep.Delete(emp);
                }

            }
        }