Exemple #1
0
 public ENewsItemSearchModel PrepareENewsItemSearchModel(ENewsItemSearchModel searchModel)
 {
     if (searchModel == null)
     {
         throw new ArgumentNullException(nameof(searchModel));
     }
     _baseAdminModelFactory.PrepareNewsPaperCategories(searchModel.AvailableCategories, true);
     searchModel.SetGridPageSize();
     return(searchModel);
 }
Exemple #2
0
        public ENewsItemListModel PrepareNewsItemListModel(ENewsItemSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var newsItems = _newsPaperServices.GetAllNews(searchModel.SearchCategoryId, searchModel.CreatedOnTo,
                                                          searchModel.Page - 1, searchModel.PageSize);
            ENewsItemListModel model = new ENewsItemListModel
            {
                Data = newsItems.Select(x =>
                {
                    ENewsItemModel newsItemModel = x.ToModel <ENewsItemModel>();
                    newsItemModel.PictureId      = x.PictureId;
                    newsItemModel.Categori       = _newsPaperServices.GetCategoriById(x.NewsPaperCategoryId).Name;
                    return(newsItemModel);
                }),
                Total = newsItems.Count
            };

            return(model);
        }
        public IActionResult List(ENewsItemSearchModel eNewsItemSearchModel)
        {
            ENewsItemListModel model = _newsPaperModelFactory.PrepareNewsItemListModel(eNewsItemSearchModel);

            return(Json(model));
        }