public async Task <IActionResult> BuscarEmpleado(string documento)
        {
            if (User.Identity.IsAuthenticated)
            {
                string permiso = Permisos("PermisoSubModulo").PSMAPB ? "PermisoSubModulo" : "PermisoModulo";
                bool   crear   = Permisos(permiso).PMMAPL.Where(w => w.Value.Contains("Crear")).Any();
                if (crear)
                {
                    EmpleadosContratados empleado = await service.BuscarEmpleado(documento);

                    return(Json(new { data = empleado }));
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
        public async Task <EmpleadosContratados> BuscarEmpleado(string documento)
        {
            try
            {
                EmpleadosContratados empleado = new EmpleadosContratados();
                empleado.Empleado = await(from t0 in context.Col_Personas
                                          join t1 in context.Col_Laborales on t0.PersonaId equals t1.PersonaId
                                          where t0.NumeroDocumento.Equals(documento) && t0.Estado.Equals("A")
                                          select new EmpleadosContratados
                {
                    Nombre      = $"{t0.PrimerNombre} {t0.PrimerApellido}",
                    Documento   = t0.NumeroDocumento,
                    NombreCargo = t1.NombreCargo,
                    Id          = t1.LaboralId
                }).FirstOrDefaultAsync();
                empleado.Insumos = await context.Col_InsumoLaboral
                                   .Where(w => w.LaboralId.Equals(empleado.Empleado.Id))
                                   .Select(s => new Col_InsumoLaboral {
                    Nombre = s.Nombre
                })
                                   .ToListAsync();

                return(empleado);
            }
            #region catch
            catch (DbEntityValidationException e)
            {
                string err = "";
                foreach (DbEntityValidationResult eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (DbValidationError ve in eve.ValidationErrors)
                    {
                        err += ve.ErrorMessage;
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                return(null);
            }

            catch (Exception e)
            {
                string err = "";
                if (e.InnerException != null)
                {
                    if (e.InnerException.Message != null)
                    {
                        err = (e.InnerException.Message);
                        if (e.InnerException.InnerException != null)
                        {
                            err += e.InnerException.InnerException.Message;
                        }
                    }
                }
                else
                {
                    err = (e.Message);
                }
                return(null);
            }
            #endregion
        }