public ActionResult DeleteConfirmed(int id) { BusShedule busSchedule = db.BusShedules.Find(id); db.BusShedules.Remove(busSchedule); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ScheduleId,CurrDayofWeek,BusNumber,TimeODay,Destination")] BusShedule busSchedule) { if (ModelState.IsValid) { db.Entry(busSchedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(busSchedule)); }
// GET: BusSchedules/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BusShedule busSchedule = db.BusShedules.Find(id); if (busSchedule == null) { return(HttpNotFound()); } return(View(busSchedule)); }
public ActionResult ScheduleView() { //var d = DayOfWeek.; string dt = DateTime.Now.DayOfWeek.ToString(); BusShedule bs = new BusShedule(); if (dt == "Monday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Monday").ToList())); } else if (dt == "Tuesday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Tuesday").ToList())); } else if (dt == "Wednesday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Wednesday").ToList())); } else if (dt == "Thursday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Thursday").ToList())); } else if (dt == "Friday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Friday").ToList())); } else if (dt == "Saturday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Saturday").ToList())); } else if (dt == "Sunday") { return(View(db.BusShedules.Where(x => x.CurrDayofWeek == "Sunday").ToList())); } else { ModelState.AddModelError("", "No Buses Available Today"); return(View()); } }
public ActionResult Create(BusShedule busSchedule) { if (ModelState.IsValid) { var tm = busSchedule.TimeODay.Split(';'); foreach (var item in tm) { busSchedule.CurrDayofWeek = busSchedule.getDay(); busSchedule.TimeODay = item; db.BusShedules.Add(busSchedule); db.SaveChanges(); } return(RedirectToAction("ScheduleView")); } ViewBag.WkdId = new SelectList(db.WeekDays, "WkdId", "CurrDayofWeek", busSchedule.WkdId); return(View(busSchedule)); }