Example #1
0
        // GET: /<controller>/
        public ViewResult Index()
        {
            var articles = _service.GetArticles(Axe.Recherche);
            var vm       = ArticleView.CreateList(articles);

            return(View(vm));
        }
Example #2
0
        // GET: Movies
        public ActionResult Index()
        {
            var articles = _service.GetArticles();
            var vm       = ArticleView.CreateList(articles);

            return(View(vm));
        }
Example #3
0
        //// GET: /<controller>/
        //public ViewResult Index()
        //{
        //    string contentRootPath = _hostingEnvironment.ContentRootPath;

        //    var articles = _service.GetArticles(Axe.Formation);
        //    var vm = ArticleView.CreateList(articles);

        //    return View(vm);
        //}

        // GET: /<controller>/
        public ViewResult Index(string url, string annee)
        {
            string contentRootPath = _hostingEnvironment.ContentRootPath;

            if (string.IsNullOrEmpty(url))
            {
                var articles = _service.GetArticles(Axe.Formation);
                var vm       = ArticleView.CreateList(articles);

                return(View(vm));
            }
            else
            {
                string  webRootPath = _hostingEnvironment.WebRootPath;
                var     articles    = _service.GetArticles(Axe.Formation);
                Article article     = articles.FirstOrDefault(s => s.Url == url && s.Annee == annee);

                var vm = ArticleView.Create(article);

                return(View("Article", vm));
            }
        }