public IActionResult ConfirmPackage() { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var subscriber = _context.Subscriber.Where(c => c.IdentityUserId == userId).FirstOrDefault(); // Use First not Single UtilityClasses.SendMessage sendMessage = new UtilityClasses.SendMessage(); sendMessage.SendText("+18053193640", "Hey" + subscriber.FullName + ", Your Subscription Package <" + subscriber.StyleName + "> is expected to be delivered on" + subscriber.DeliveryDate); return(View()); }
public IActionResult TextSubscriber() { //Send Message instance to send text messages UtilityClasses.SendMessage sendMessage = new UtilityClasses.SendMessage(); //Get the list of all the subscribers who have ordered their Style Package List <Subscriber> subscribers = _context.Subscriber.Where(s => s.PackageOrdered == 1).ToList(); //Loop through every subscrier in the list and send him/her a personalized text message regarding their package for (int i = 0; i < subscribers.Count; i++) { //Sending personalized text message here sendMessage.SendText(subscribers[i].PhoneNumber, subscribers[i].FullName + ", Your subsription pacakge is out for deliery. With the delivdry date: " + subscribers[i].DeliveryDate + "and the package is" + subscribers[i].StyleName); } return(View()); }