public async Task <ActionResult <string> > AddPost([FromBody] AddPostViewModel value) { try { var post = new Post() { PostId = value.postId, Slug = value.Slug, MarkDown = value.MarkDown, Content = value.Content, CreateDate = DateTime.Now, Tags = value.Tags, Title = value.Title, UserId = this.User.Identity.Name }; var result = await _post.AddOrEdit(post); await _hubContext.Clients.All.SendAsync("News", "Kevin", "I posted an article"); return(Ok(new { result = result, Msg = "" })); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(Ok(new { result = false, Msg = ex.Message })); } }