private Employee cast(Model.EmployeesTPH emp)
 {
     if (emp == null)
     {
         return(null);
     }
     if (emp.GetType().Name == "FullTimeEmployee")
     {
         Model.FullTimeEmployees employee     = (Model.FullTimeEmployees)emp;
         FullTimeEmployee        employeeBase = new FullTimeEmployee()
         {
             Id        = employee.EmployeeId,
             Name      = employee.name,
             StartDate = employee.StartDate,
             Salary    = employee.Salary
         };
         return(employeeBase);
     }
     else
     {
         Model.PartTimeEmployees employee     = (Model.PartTimeEmployees)x;
         PartTimeEmployee        employeeBase = new PartTimeEmployee()
         {
             Id         = employee.EmployeeId,
             Name       = employee.name,
             StartDate  = employee.StartDate,
             HourlyRate = employee.HourlyRate
         };
         return(employeeBase);
     }
 }
 private Model.EmployeesTPH cast(Employee emp)
 {
     if (emp == null)
     {
         return(null);
     }
     if (emp.GetType().Name == "FullTimeEmployee")
     {
         FullTimeEmployee        employee     = (FullTimeEmployee)emp;
         Model.FullTimeEmployees employeeBase = new Model.FullTimeEmployees()
         {
             name      = employee.Name,
             StartDate = employee.StartDate,
             Salary    = employee.Salary
         };
         return(employeeBase);
     }
     else
     {
         PartTimeEmployee        employee     = (PartTimeEmployee)emp;
         Model.PartTimeEmployees employeeBase = new Model.PartTimeEmployees()
         {
             name       = employee.Name,
             StartDate  = employee.StartDate,
             HourlyRate = employee.HourlyRate
         };
         return(employeeBase);
     }
 }
 public void UpdateEmployee(Employee emp)
 {
     if (emp == null)
     {
         return;
     }
     using (Model.Obligatorio1Entities en = new Model.Obligatorio1Entities())
     {
         Model.EmployeesTPH em = en.EmployeesTPH.Find(emp.Id);
         em.name      = emp.Name;
         em.StartDate = emp.StartDate;
         if (emp.GetType().Name == "FullTimeEmployee")
         {
             Model.FullTimeEmployees emCast = (Model.FullTimeEmployees)em;
             emCast.Salary = ((FullTimeEmployee)emp).Salary;
         }
         else
         {
             Model.PartTimeEmployees emCast = (Model.PartTimeEmployees)em;
             emCast.HourlyRate = ((PartTimeEmployee)emp).HourlyRate;
         }
         en.SaveChanges();
     }
 }