Exemple #1
0
        //Tetiana
        //metode henter alle kategorier fra DAL, og basert på type returnerer top 5 kategorier
        //fra statistikk eller alle kategorier med søkeresultatet
        public List <KategoriDTO> GetMainCategories(int typeId, int?count, string searchText)
        {
            var allCategories = dal.GetMainCategories(typeId, searchText);

            if (count.HasValue)
            {
                var topCategories = dal.GetTopCategoriesForSvarbot(typeId, count.Value).ToList();
                var result        = (from c in allCategories
                                     join top in topCategories on c.id equals top.CategoryId
                                     select c).ToList();
                return(result);
            }

            return(allCategories);
        }