예제 #1
0
        // Sends area code and phone number to SMSTextMessage/Index
        public ActionResult SendMessage(String AreaCode, String PhoneNumber)
        {
            SMSTextMessage sms = new SMSTextMessage();

            AreaCode    = sms.AreaCode;
            PhoneNumber = sms.PhoneNumber;
            return(View("~/Views/SMSTextMessage/Index.cshtml", sms));
        }
        public ActionResult Index(SMSTextMessage sms)
        {
            if (ModelState.IsValid)
            {
                // findContact returns error, an error message is broadcast to the screen.
                // otherwise it broadcasts a success message
                Contacts contactsIndex = new Contacts();
                string   findContact   = contactsIndex.findContact(sms.AreaCode, sms.PhoneNumber);

                if (findContact == "error")
                {
                    ViewData["SuccessMsg"] = "Error. Contact does not exist. Goto contacts page above.";
                }
                else
                {
                    ViewData["SuccessMsg"] = "Message was successfully sent.";
                }
            }
            return(View(sms));
        }