public IActionResult Create(News news) { if (ModelState.IsValid) { SaveImage(news); _newsRepo.Add(news); return(RedirectToAction("Index")); } return(View(news)); }
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); }
public IActionResult Create(News news) { news.DateCreate = DateTime.Now; _newsRepos.Add(news); return(RedirectToAction("Index")); }