public ActionResult DeleteConfirmed(int id) { CinemaSchedule cinemaSchedule = db.CinemaSchedule.Find(id); db.CinemaSchedule.Remove(cinemaSchedule); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: CinemaSchedules/Details/5 public ActionResult Details(int id) { CinemaSchedule cinemaSchedule = db.CinemaSchedule.Find(id); if (cinemaSchedule == null) { return(HttpNotFound()); } return(View(cinemaSchedule)); }
// GET: CinemaSchedules/Delete/5 public ActionResult Delete(int id) { CinemaSchedule cinemaSchedule = db.CinemaSchedule.Find(id); if (cinemaSchedule == null) { return(HttpNotFound()); } if (cinemaSchedule.CinemaScheduleHistory.Where(t => t.TicketId != 0).Count() > 0) { return(RedirectToAction("Index")); } return(View(cinemaSchedule)); }
private static IList <CinemaSchedule> GenerateCinemaSchedules(CinemaScheduleViewModel cinemaSchedule, List <DateTime> dates, int durationMovie) { IList <CinemaSchedule> cinemaSchedules = new List <CinemaSchedule>(); foreach (var date in dates) { CinemaSchedule scheduler = new CinemaSchedule() { BeginDatetime = date, CinemaId = cinemaSchedule.CinemaId, MovieFormatId = cinemaSchedule.MovieFormatId, MovieId = cinemaSchedule.MovieId }; scheduler.FinishDatetime = scheduler.BeginDatetime.AddMinutes(durationMovie); cinemaSchedules.Add(scheduler); } return(cinemaSchedules); }
public void Setup() { cinemaSchedule = CinemaSchedule.Create(Movies); }