public async Task <IActionResult> PostMessages([FromBody] Message model) { try { var message = repo.PostMessage(model); await hub.Clients.All.SendAsync("sendMessage", message); return(StatusCode(StatusCodes.Status200OK, message)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status400BadRequest, ex.Message)); } }