public IEnumerable <SelectListItem> GetCategoriaGastoSelectionList()
        {
            IQueryable <CategoriaGasto> tCategoria = context.Set <CategoriaGasto>().AsNoTracking();

            var result = from categoria in tCategoria
                         select new SelectListItem {
                Id   = categoria.IdCategoria,
                Desc = categoria.Descripcion
            };

            return(result.ToList());
        }
Exemple #2
0
        public CategoriaGasto GetCategoriaByIdSubcategoria(int idSubcategoria)
        {
            IQueryable <CategoriaGasto>    tCategoria    = context.Set <CategoriaGasto>().AsNoTracking();
            IQueryable <SubcategoriaGasto> tSubcategoria = context.Set <SubcategoriaGasto>().AsNoTracking();

            var result = from categoria in tCategoria
                         join subcategoria in tSubcategoria
                         on categoria.IdCategoria equals subcategoria.IdCategoria
                         where subcategoria.IdSubcategoria == idSubcategoria
                         select categoria;

            return(result.First());
        }