public ResultViewModel <IEnumerable <ManageCategoryViewModel> > GetList(int PageIndex, int PageSize, string SearchIn) { ResultViewModel <IEnumerable <ManageCategoryViewModel> > result = new ResultViewModel <IEnumerable <ManageCategoryViewModel> >(); int count = 0; try { if (SearchIn == "MainCategory") { var searshResult = mainCategoryService.GetAll(out count, 0, PageIndex, PageSize). Select(i => i.ToManageCategoryViewModel()).OrderBy(i => i.ID); result.Data = searshResult; } else if (SearchIn == "SubCategory") { var searshResult = subCategoryService.GetAll(out count, 0, PageIndex, PageSize). Select(i => i.ToManageCategoryViewModel()); result.Data = searshResult; } else if (SearchIn == "Track") { var searshResult = trackService.GetAll(out count, 0, PageIndex, PageSize). Select(i => i.ToManageCategoryViewModel()); result.Data = searshResult; } else if (SearchIn == "Course") { var searshResult = courseService.GetAll(out count, 0, PageIndex, PageSize). Select(i => i.ToManageCategoryViewModel()); result.Data = searshResult; result.Count = courseService.Count(); } result.Successed = true; } catch (Exception ex) { result.Successed = false; result.Message = "Something Went Wrong !!"; } return(result); }
public ResultViewModel <IEnumerable <HomeViewModel> > GetAllMainCategory(int PageSize, int PageIndex) { ResultViewModel <IEnumerable <HomeViewModel> > result = new ResultViewModel <IEnumerable <HomeViewModel> >(); int count = 0; try { result.Data = mainCategoryService.GetAll(out count, 0, PageIndex, PageSize).Select(i => i.ToHomeViewmodel()); result.Successed = true; result.Count = count; } catch (Exception ex) { result.Successed = false; result.Message = "Something Went Wrong !!"; } return(result); }
public ResultViewModel <IEnumerable <MainCategoryViewModel> > GetList(int pageIndex, int pageSize = 20) { ResultViewModel <IEnumerable <MainCategoryViewModel> > result = new ResultViewModel <IEnumerable <MainCategoryViewModel> >(); int count = 0; try { var MainCategories = mainCategoryService.GetAll(out count, 0, pageIndex, pageSize); result.Successed = true; result.Data = MainCategories; } catch (Exception ex) { result.Successed = false; result.Message = "Something Went Wrong !!"; } return(result); }