コード例 #1
0
        //GET: Estados
        public ActionResult Index()
        {
            var daoCategoria       = new DAOCategoria();
            List <Categoria> lista = daoCategoria.GetCategorias().ToList();

            return(View(lista));
        }
コード例 #2
0
        private IQueryable <dynamic> Find(int?id, string q)
        {
            var daoCategoria = new DAOCategoria();
            var list         = daoCategoria.GetCategorias();
            var select       = list.Select(u => new
            {
                id             = u.idCategoria,
                text           = u.nmCategoria,
                dtCadastro     = u.dtCadastro,
                dtUltAlteracao = u.dtAtualizacao
            }).OrderBy(u => u.text).ToList();

            if (id != null)
            {
                return(select.Where(u => u.id == id).AsQueryable());
            }
            else
            {
                return(select.AsQueryable());
            }
        }