public ActionResult DeleteConfirmed(int id)
        {
            RTServiceAlerts rTServiceAlerts = db.RTServiceAlerts.Find(id);

            db.RTServiceAlerts.Remove(rTServiceAlerts);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "id,route_id,stop_id,header,description,start_date,end_date")] RTServiceAlerts rTServiceAlerts)
        {
            if (ModelState.IsValid)
            {
                db.RTServiceAlerts.Add(rTServiceAlerts);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rTServiceAlerts));
        }
        // GET: RTServiceAlert/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RTServiceAlerts rTServiceAlerts = db.RTServiceAlerts.Find(id);

            if (rTServiceAlerts == null)
            {
                return(HttpNotFound());
            }
            return(View(rTServiceAlerts));
        }
        private string processAlert(string mobileNumber, string route, string cleanMessage)
        {
            var serviceAlert = cleanMessage.Replace("ALERT " + route + " ", "");

            RTServiceAlerts rtSa = new RTServiceAlerts();

            rtSa.route_id    = "ROU" + route;
            rtSa.header      = "Service Advisory for " + route;
            rtSa.description = serviceAlert;
            rtSa.start_date  = DateTime.UtcNow.AddHours(8);
            db.RTServiceAlerts.Add(rtSa);

            return("success");
        }
        public ActionResult Edit([Bind(Include = "id,header,description,start_date,end_date")] RTServiceAlerts rTServiceAlerts)
        {
            if (ModelState.IsValid)
            {
                RTServiceAlerts recOrig = db.RTServiceAlerts.Find(rTServiceAlerts.id);
                recOrig.header      = rTServiceAlerts.header;
                recOrig.description = rTServiceAlerts.description;
                recOrig.start_date  = rTServiceAlerts.start_date;
                recOrig.end_date    = rTServiceAlerts.end_date;

                db.Entry(recOrig).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(rTServiceAlerts));
        }
        // GET: RTServiceAlert/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            List <RTServiceAlerts> data = db.Database
                                          .SqlQuery <RTServiceAlerts>("RTServiceAlertsGetFormattedByID @id",
                                                                      new SqlParameter("@id", id))
                                          .ToList();

            if (data.Count == 0)
            {
                return(HttpNotFound());
            }
            RTServiceAlerts rTServiceAlerts = data[0];

            return(View(rTServiceAlerts));
        }