Ejemplo n.º 1
0
        //public ActionResult Index(string routeModelStr)
        //{
        //    List<Article> model;
        //    if (!string.IsNullOrEmpty(routeModelStr))
        //    {
        //        model = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Article>>(routeModelStr);
        //    }
        //    else
        //    {
        //        model= _articleManager.GetAll();
        //    }
        //    return View(model.OrderByDescending(x => x.ArticleModifiedDate).ToList());
        //}

        public ActionResult Index(List <Article> articles)
        {
            List <Article> model;

            if (articles != null && articles.Count > 0)
            {
                model = articles;
            }
            else
            {
                model = _articleManager.GetAll();
            }
            return(View(model.Where(x => x.IsDraft == false).OrderByDescending(x => x.ArticleModifiedDate).ToList()));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ArticleManager  articleManager  = new ArticleManager(new EfArticleDal());
            CategoryManager categoryManager = new CategoryManager(new EfCategoryDal());

            //Article newArticle = new Article
            //{
            //    AuthorId = 3,
            //    Title = "Başarı",
            //    CategoryId = 3,
            //    Date = DateTime.Now,
            //    Writing = "Çalışmaya oturduğun zaman tıpkı ateş hattında düşmanı gözetleyen bir asker gibi uyanık ol ve dikkat kesil. Ve bütün ruhi ve bedeni kuvvetinle kendini işe ver."

            //};
            //articleManager.ArticleAdd(newArticle);



            foreach (var category in categoryManager.GetAllCategory().Data)
            {
                Console.WriteLine(category.Id + "--" + category.CategoryName);
            }


            Console.WriteLine("------");

            foreach (var article in articleManager.GetAll().Data)
            {
                Console.WriteLine(article.AuthorId + " -- " + article.Title + " -- " + article.Date.Year + " -- " + article.Writing);
            }


            Console.ReadKey();
        }
Ejemplo n.º 3
0
        // GET: Article
        public ActionResult ListArticle()
        {
            var model = _articleManager.GetAll();

            return(View(model));
        }