Exemplo n.º 1
0
        public IActionResult SearchPostCategory(PostCategoriesSearchModel searchModel)
        {
            var res = _postCategoryService.GetPostCategories(searchModel);

            if (res != null)
            {
                return(OkBaseResponse(res));
            }
            return(ErrorBaseResponse(System.Net.HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IActionResult ListData(PostCategoriesSearchModel model)
        {
            var res          = _postCategoryService.SearchPostCategory(model).Result;
            var allLanguages = _selectListService.PreparingLanguageList();

            foreach (var item in res.Data)
            {
                var languageDetails = _postCategoryDetailService.GetPostCateDetailByPostCateId(item.Id).Result;
                var languages       = languageDetails.GetDataResponse();
                item.CustomProperties["Languages"] = languages.Select(x => new SelectListItem
                {
                    Text     = allLanguages.Find(l => l.Value == x.LanguageFid.ToString())?.Text,
                    Value    = x.LanguageFid.ToString(),
                    Selected = x.IsActivated
                });
            }
            ViewBag.recordTotal = res.Data.Count();
            return(PartialView("_List", res.Data));
        }
Exemplo n.º 3
0
 public IPagedList <PostCategoriesViewModel> GetPostCategories(PostCategoriesSearchModel searchModel)
 {
     try
     {
         int totalRows = 0;
         var query     = _dbCMSContext.PostCategories
                         .AsNoTracking()
                         .Where(x => !x.Deleted)
                         .OrderBy(x => x.OrderBy);
         var res = _mapper.ProjectTo <PostCategoriesViewModel>(query).ToList();
         if (query.Count() > 0)
         {
             totalRows = query.Count();
         }
         return(new PagedList <PostCategoriesViewModel>(res, searchModel.PageIndex, searchModel.PageSize, totalRows));
     }
     catch (AQException ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public async Task <PagedListClient <PostCategoriesViewModel> > SearchPostCategory(PostCategoriesSearchModel model)
        {
            try
            {
                var req = new BaseRequest <PostCategoriesSearchModel>(model);
                var res = await _aPIExcute.PostData <PagedListClient <PostCategoriesViewModel>, PostCategoriesSearchModel>($"{_baseAdminAPIUrl}{_adminPortalApiUrl.PostCategoriesAPI.Search}", HttpMethodEnum.POST, req, Token);

                if (!res.IsSuccessStatusCode)
                {
                    return(null);
                }
                return(res.ResponseData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }