Exemplo n.º 1
0
    public List <Editor> BuscarEditores(string busqueda)
    {
        List <Editor> editores = null;

        try
        {
            EditoresController controller = new EditoresController();
            if (AutenticacionSitio.IsUsuarioAutenticado())
            {
                editores = controller.BuscarPor(busqueda, new int?(30));
            }
            else
            {
                HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
            }
            if (editores == null || editores.Count <= 0)
            {
                editores = new List <Editor>()
                {
                    new Editor()
                    {
                        IdEditor = "", Nombre = "NO SE ENCONTRO EL EDITOR"
                    }
                };
            }
        }
        catch (Exception ex)
        {
            editores = new List <Editor>()
            {
                new Editor()
                {
                    IdEditor = "", Nombre = "NO SE ENCONTRO EL EDITOR"
                }
            };
            HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
        }
        return(editores);
    }