Пример #1
0
 public ActionResult Create(Article article)
 {
     if (article.Title != null && article.Text != null)
     {
         articleService.AddNewArticle(article);
         return(RedirectToAction("Index"));
     }
     return(View(view.Article));
 }
Пример #2
0
        public async Task <ActionResult <Article> > Create(Article article)
        {
            if (article.UserName != null)
            {
                userService.AddNewUser(article.UserName);

                articleService.AddNewArticle(article);
            }

            return(CreatedAtAction(nameof(GetById), new { id = article.Id }, article));
        }