Exemple #1
0
        public Data <PersonaQuery> GetAll()
        {
            Data <PersonaQuery>  data = new Data <PersonaQuery>();
            IList <PersonaQuery> list = new List <PersonaQuery>();

            list      = personaRepository.GetAll();
            data.data = list;

            if (list.Count != 0)
            {
                data.message = "";
                data.status  = Status.Ok;

                foreach (PersonaQuery persona in list)
                {
                    if (persona.imagen.Trim().Length == 0)
                    {
                        persona.imagen = "/uploads/imagen/miniatura/miniatura.png";
                    }
                    else
                    {
                        persona.imagen = "/uploads/imagen/miniatura/" + persona.imagen;
                    }
                }
            }
            else
            {
                data.message = "No hay Personas";
                data.status  = Status.Error;
            }


            return(data);
        }
 public DataTable GetAll()
 {
     return(repositorio.GetAll());
 }
        public ActionResult Find(string q)
        {
            IRepositorioPersona<Persona> repoP = new PersonaRepositorio();
            IList<Persona> personas = repoP.GetAll();
            IList<Persona> posiblesAmigos = new List<Persona>();

            foreach (var item in personas)
            {
                if (item.Nickname.Contains(q.ToUpper()) || item.Nickname.Contains(q.ToLower()))
                {
                    posiblesAmigos.Add(repoP.GetById(item.Nickname));
                }
            }
            string[] ami = new string[posiblesAmigos.Count];
            int i = 0;
            foreach (var persona in posiblesAmigos)
            {
                ami[i] = persona.Nickname;
                i++;
            }

            return Content(string.Join("\n", ami)); ;
        }