Пример #1
0
        public ActionResult Create([Bind("Title,Content,Author,ShowPost")] BlogModel blog)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.AddBlogToDb(blog.Title, blog.Content, blog.Author, blog.ShowPost);

                    _toastNotification.AddSuccessToastMessage("Created a new Blog");
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                _toastNotification.AddErrorToastMessage("Error Creating new blog");

                return(View(blog));
            }
        }