示例#1
0
        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());
        }
示例#2
0
 // Application starting point
 public void Run()
 {
     _rabbitMQService.Send();
 }