コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            RTServiceAlerts rTServiceAlerts = db.RTServiceAlerts.Find(id);

            db.RTServiceAlerts.Remove(rTServiceAlerts);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        // 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));
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        // 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));
        }