Esempio n. 1
0
        public async Task <IActionResult> NewCategory(Category category)
        {
            try
            {
                var result = await blogService.AddCategory(category);

                var blogInfo = new BlogInfo {
                    Id = result.Id
                };
                return(Ok(blogInfo));
            }
            catch (InternalException ie)
            {
                logger.LogError(500, ie, ie.Message, null);
                return(NotFound(ie.Message));
            }
            catch (BadRequestException be)
            {
                logger.LogError(404, be, be.Message, null);
                return(BadRequest(be.Message));
            }
        }
Esempio n. 2
0
 public CategoryContentViewModel Add(string title, string description)
 {
     return(_blogService.AddCategory(title, description));
 }