public async Task <IActionResult> AddBlog([FromBody] BlogModel newBlog) { if (string.IsNullOrEmpty(newBlog?.Title)) { return(BadRequest()); } if (string.IsNullOrEmpty(newBlog?.Content)) { return(BadRequest()); } var userId = User.Claims.FirstOrDefault(c => c.Type == "uid")?.Value; if (string.IsNullOrEmpty(userId)) { return(BadRequest()); } await _blogService.AddItem(userId, newBlog.Title, newBlog.Content); return(Ok()); }