コード例 #1
0
 public void SaveSmsMessage(DtoSmsMessage message)
 {
     _context.Add(new SmsMessage
     {
         Id         = message.Id,
         CreateDate = DateTime.Now,
         Phone      = message.Phone,
         Text       = message.Text
     });
     _context.SaveChanges();
 }
コード例 #2
0
        public ActionResult SendSms(DtoSmsMessage message)
        {
            if (!_settings.IsSmsSenderActive)
            {
                return(StatusCode(StatusCodes.Status503ServiceUnavailable));
            }

            _messageRepository.SaveSmsMessage(message);

            _traceService.WriteMessageAsync(
                "SmsMessage",
                $"{message.Phone}: {message.Text}"
                );

            return(Ok());
        }