コード例 #1
0
        // GET: /<controller>/
        public ViewResult Article(string url)
        {
            var     articles = _service.GetArticles(Axe.Recherche);
            Article article  = articles.Where(s => s.Titre == url).FirstOrDefault();
            var     vm       = ArticleView.Create(article);

            return(View("Article", vm));
        }
コード例 #2
0
ファイル: ArticlesController.cs プロジェクト: cornell/apropos
        // GET: Movies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Article article = _service.GetArticles().Find(s => s.Id == id);
            var     vm      = ArticleView.Create(article);

            if (article == null)
            {
                return(NotFound());
            }
            return(View(vm));
        }
コード例 #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));
            }
        }