Exemple #1
0
        public IActionResult AddBlog(String title, String content, Guid categoryId = default(Guid), Guid tagId = default(Guid))
        {
            if (String.IsNullOrEmpty(title))
            {
                throw new ArgumentNullException($"{nameof(title)}");
            }

            if (String.IsNullOrEmpty(content))
            {
                throw new ArgumentNullException($"{nameof(content)}");
            }

            if (categoryId == Guid.Empty)
            {
                throw new ArgumentNullException($"{nameof(categoryId)}");
            }

            if (tagId == Guid.Empty)
            {
                throw new ArgumentNullException($"{nameof(tagId)}");
            }

            _blogService.AddNewBlog(title, content, categoryId, tagId);

            return(Json(new { }));
        }