public ActionResult Create(FullBlogViewModel blog) { if (!String.IsNullOrWhiteSpace(blog.Name)) { blog.User = _userService.GetUserByNickname(User.Identity.Name)?.ToMvcUser(); _blogService.CreateBlog(blog.ToBllFullBlog()); return(RedirectToAction("Index", "Article")); } return(RedirectToAction("Create", "Blog")); }
public ActionResult Delete(FullBlogViewModel fullblog) { fullblog = _blogService.GetBlogById(fullblog.Id)?.ToMvcFullBlog(); if (User.Identity.Name != fullblog.User.NickName) { return(RedirectToAction("Index", "Article")); } fullblog.Articles = _articleService.GetAllByBlog(fullblog.Id)?.Select(x => _articleService.GetFullArticleEntity(x).ToMvcFullArticle()).ToList(); _blogService.DeleteBlog(fullblog.ToBllFullBlog()); return(RedirectToAction("Profile")); }