public IList <ArticleDto> GetArticles(int pageIndex, int pageSize)
        {
            IList <Article>   articles = _articlesRepository.GetArticles(pageIndex, pageSize);
            List <ArticleDto> dto      = _mapper.Map <List <ArticleDto> >(articles);

            return(dto);
        }
Example #2
0
        /// <summary>
        /// Удаление научных статей из базы данных, опубликованных до указанного года включительно
        /// </summary>
        /// <returns></returns>
        public IActionResult RemoveArticles(int year)
        {
            var articlesToDelete = new List <Article>();

            if (year != 0)
            {
                articlesToDelete = _articlesRepository.GetArticles(year).ToList();
            }

            ViewBag.Year = year;

            return(View(articlesToDelete));
        }
        public IEnumerable <Article> GetArticles()
        {
            _logger.LogInformation("Call GetArticles method");

            var articles = _repository.GetArticles();

            return(articles);
        }
Example #4
0
        // GET api/default1/5
        public IHttpActionResult  Getnew(int id)
        {
            Articles articles = _ArticlesRepository.GetArticles(id);

            if (articles == null)
            {
                return(NotFound());
            }
            return(Ok(articles));
        }
Example #5
0
        public async Task <IActionResult> GetArticles()
        {
            var articles = await _articlesRepo.GetArticles();

            if (articles == null)
            {
                return(NotFound());
            }

            return(Ok(articles));
        }
Example #6
0
        public IActionResult Index()
        {
            int page = int.TryParse(Request.Query["p"], out page) ? page : 1;

            var articles = _articlesRepository.GetArticles(PageSize + 1, (page - 1) * PageSize);

            var vm = new HomeViewModel()
            {
                Articles        = articles.Take(PageSize),
                CurrentPage     = page,
                HasPreviousPage = page > 1,
                HasNextPage     = articles.Count() > PageSize
            };

            return(View(vm));
        }
        // GET: Articles
        public IActionResult Index()
        {
            var articles = _articlesRepository.GetArticles();

            return(View(articles));
        }