コード例 #1
0
        public async Task <ActionResult> PostMessage([FromBody] MessageDto messageDto)
        {
            var message = new Message
            {
                Name      = messageDto.Name,
                Content   = messageDto.Content,
                TimeStamp = DateTime.Now
            };
            await _context.AddAsync(message);

            await _context.SaveChangesAsync();

            return(Ok(message));
        }
コード例 #2
0
 public IActionResult SendRequest([FromBody] MessageDto msg)
 {
     _hubContext.Clients.All.SendAsync("ReceiveOne", msg.user, msg.msgText);
     return(Ok());
 }