public IEnumerable <CategoryVM> GetCategoryList()
        {
            var categories = (from c in db.Categories
                              select c).ToList();
            List <CategoryVM> categoriesList = new List <CategoryVM>();

            foreach (var item in categories)
            {
                var subCatLists = (from SC in db.SubCategories
                                   where SC.Category_Id == item.Id
                                   select SC).ToList();
                CategoryVM catVm = ConvertClass.CategoryToVM(item, subCatLists);
                categoriesList.Add(catVm);
            }
            return(categoriesList);
        }
        ////////////////////////////////////////////
        public CategoryVM GetCategories(string ID)
        {
            var categories = (from c in db.Categories
                              where c.Name == ID
                              select c).ToList();
            CategoryVM categoriesList = new CategoryVM();

            foreach (var item in categories)
            {
                var subCatLists = (from SC in db.SubCategories
                                   where SC.Category_Id == item.Id
                                   select SC).ToList();
                CategoryVM catVm = ConvertClass.CategoryToVM(item, subCatLists);
                categoriesList = catVm;
            }
            return(categoriesList);
        }
        public IEnumerable <CategoryVM> GetCategories()
        {
            var categories =
                (from c in db.Categories
                 select c).ToList();

            List <CategoryVM> categoriesList = new List <CategoryVM>();

            categoriesList.Add(new CategoryVM {
                Id = 0, Name = "All Category"
            });
            foreach (var item in categories)
            {
                categoriesList.Add(ConvertClass.CategoryToVM(item));
            }
            return(categoriesList);
        }