Esempio n. 1
0
 public IActionResult Create(News news)
 {
     if (ModelState.IsValid)
     {
         SaveImage(news);
         _newsRepo.Add(news);
         return(RedirectToAction("Index"));
     }
     return(View(news));
 }
Esempio n. 2
0
        public void AddNews(NewsAddVM newsAdd)
        {
            News news = new News
            {
                Name        = newsAdd.Name,
                Image       = newsAdd.Image,
                UrlSlug     = newsAdd.UrlSlug,
                Description = newsAdd.Description,
                DateCreate  = DateTime.Now
            };

            _newsRepo.Add(news);
        }
Esempio n. 3
0
 public IActionResult Create(News news)
 {
     news.DateCreate = DateTime.Now;
     _newsRepos.Add(news);
     return(RedirectToAction("Index"));
 }