Esempio n. 1
0
 static Article()
 {
     Empty = new Article
                 {
                         Id = 0,
                         Title = string.Empty,
                         Abstract = string.Empty,
                         Author = string.Empty,
                         Category = Category.Main,
                         Content = string.Empty,
                         PublishDate = DateTime.UtcNow
                 };
 }
Esempio n. 2
0
        public ActionResult Create(Category category, ArticleNew articleNew)
        {
            if (ModelState.IsValid)
            {
                Article article = new Article();
                article.InjectFrom(articleNew);

                articlesRepository.Articles.Add(article);
                articlesRepository.SaveChanges();
                return RedirectToAction("Index", new { category });
            }

            return View(articleNew);
        }