public async Task <IActionResult> Index(string keywork, int?pageSize, int page = 1) { var classified = new ClassifiedsDetailVM(); var data = await _classifiedsService.GetHotProduct(8); var listData = data.Select(a => ClassifiedsViewModel.form(a)).ToList(); classified.RelatedBlogs = listData; return(View(classified)); }
public async Task <IActionResult> Detail(int id) { var dataVM = new ClassifiedsDetailVM(); var data = await _classifiedsService.GetById(id); var RelatedBlogs = _classifiedsService.RelatedBlog(id, 8); dataVM.Data = ClassifiedsViewModel.form(data); dataVM.RelatedBlogs = RelatedBlogs; return(View(dataVM)); }
public async Task <IActionResult> ViewAll(string keywork, int?pageSize = 2, int page = 1) { var classified = new ClassifiedsVM(); if (pageSize == null) { pageSize = _configuration.GetValue <int>("PageSize"); } classified.PageSize = pageSize; var data = await _classifiedsService.GetViewAll(keywork, page, pageSize.Value); var listData = data.Results.Select(a => ClassifiedsViewModel.form(a)).ToList(); var paginationSet = new PagedResult <ClassifiedsViewModel>() { Results = listData, CurrentPage = page, RowCount = data.RowCount, PageSize = data.PageSize, }; classified.Data = paginationSet; return(View(classified)); }