public HttpResponseMessage SendMessage(TwilioMessaging model) { try { model.MessageBody = "Message from VetChat" + Environment.NewLine + Environment.NewLine + model.MessageBody + Environment.NewLine + Environment.NewLine + model.MyPhone + Environment.NewLine + Environment.NewLine + model.Signature; TwilioService.SendMessage(model.PhoneNumberTo, model.MessageBody); SuccessResponse response = new SuccessResponse(); return(Request.CreateResponse(response)); } catch (Exception ex) { var response = new ErrorResponse(ex.Message); return(Request.CreateResponse(response)); } }
public IActionResult SendMessage(string guid) { if (Guid.TryParse(guid, out var id)) { if (_lobbyPad.TryGetById(id, out var entry)) { _twilio.SendMessage(entry.PhoneNumber, "Your table is ready at Village Inn!", out _); entry.Status = LobbyEntryStatus.Messaged; entry.MessageSentTime = DateTime.Now; _lobbyPad.TryUpdate(entry); } } return(RedirectToAction("Index")); }