Exemplo n.º 1
0
        public IActionResult EditArticleContent(string id)
        {
            var article = _articleRepo.GetAll().Include(x => x.Category)
                          .FirstOrDefault(x => x.Id == id);

            EditArticleContentViewModel model = new EditArticleContentViewModel()
            {
                Content = article.Content,
                Title   = article.Title
            };


            return(View(model));
        }
Exemplo n.º 2
0
        public IActionResult EditArticleContent(EditArticleContentViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            var article = _articleRepo.GetAll().Include(x => x.Category)
                          .FirstOrDefault(x => x.Id == model.Id);

            article.Content = model.Content;
            model.Title     = article.Title;

            _articleRepo.Save();

            TempData["Message"] = "Makalenizin içeriği başarı ile değiştirildi.";
            return(View(model));
        }