Ejemplo n.º 1
0
 public async Task <IActionResult> AddMessage(MessageRequest message)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState.Values.Select(r => r.Errors.First())));
     }
     try
     {
         await _context.AddMessage(message.ToMessage());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
     return(NoContent());
 }