public IActionResult GetCategoriDelete(int id)
        {
            NewsPaperCategory categori = _newsPaperServices.GetCategoriById(id);

            _newsPaperServices.DeleteNewsCategory(categori);
            SuccessNotification("Categori Silindi.");
            return(new NullJsonResult());
        }
Beispiel #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);
        }