public async Task <IActionResult> SendMessage(ChatMessage model) { if (ModelState.IsValid) { if (model.IsCommand()) { var command = model.GetCommand(); //TODO send command to rabbitMQ _mQService.Send(command); } else { model.UserName = User.Identity.Name; var user = await _userManager.GetUserAsync(User); model.UserId = user.Id; await _context.AddAsync(model); await _context.SaveChangesAsync(); } return(Ok()); } return(Error()); }
// Application starting point public void Run() { _rabbitMQService.Send(); }