Exemplo n.º 1
0
        public IActionResult Create(BlogManagementCreateModel model)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception();
            }

            var title = model.Title.Trim();
            var entry = _blogEntryRepository.Create(new BlogEntry()
            {
                Title = title,
                Key   = title.UrlKey(),
                BlogPublishDateTimeUtc = DateTime.UtcNow
            });

            if (entry.BlogEntryId > 0)
            {
                return(RedirectToAction("Edit", new { blogEntryId = entry.BlogEntryId }));
            }
            else
            {
                return(View(entry));
            }
        }
Exemplo n.º 2
0
        public IActionResult Create()
        {
            var model = new BlogManagementCreateModel();

            return(View(model));
        }