public ActionResult DeleteConfirmed(string id) { SeatGroup seatGroup = db.SeatGroups.Find(id); db.SeatGroups.Remove(seatGroup); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "sgID,flightSize,totalFC,totalBC,totalPEC,totalEC")] SeatGroup seatGroup) { if (ModelState.IsValid) { db.Entry(seatGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(seatGroup)); }
public ActionResult Create([Bind(Include = "sgID,flightSize,totalFC,totalBC,totalPEC,totalEC")] SeatGroup seatGroup) { if (ModelState.IsValid) { db.SeatGroups.Add(seatGroup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(seatGroup)); }
// GET: SeatGroups/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SeatGroup seatGroup = db.SeatGroups.Find(id); if (seatGroup == null) { return(HttpNotFound()); } return(View(seatGroup)); }
public IHttpActionResult Top10SeatReservationFrequency(StatisticsParameters statisticsParameters) { var CinemaID = statisticsParameters.CinemaID; var TechTypeID = statisticsParameters.TechTypeID; var MovieID = statisticsParameters.MovieID; var fltMovies = new List <int>(); var fltTechTypes = new List <int>(); fltMovies.AddRange((MovieID == 0) ? principal.Movies.Select(x => x.MovieID).ToList() : principal.Movies.Where(x => x.MovieID == MovieID).Select(x => x.MovieID).ToList()); fltTechTypes.AddRange((TechTypeID == 0) ? principal.TechnologyTypes.Select(x => x.TechnologyTypeID).ToList() : principal.TechnologyTypes.Where(x => x.TechnologyTypeID == TechTypeID).Select(x => x.TechnologyTypeID).ToList()); DateTime DateTimeFrom = statisticsParameters.DateTimeFrom; DateTime DateTimeTo = statisticsParameters.DateTimeTo; var Frequency = (from T in principal.Tickets join P in principal.Projections on T.ProjectionID equals P.ProjectionID join M in principal.Movies on P.MovieID equals M.MovieID join G in principal.Genres on M.GenreID equals G.GenreID join TT in principal.TechnologyTypes on P.TechnologyTypeID equals TT.TechnologyTypeID join CHS in principal.CinemaHalls on P.CinemaHallID equals CHS.CinemaHallID join CS in principal.Cinemas on CHS.CinemaID equals CS.CinemaID where P.DateTimeStart >= DateTimeFrom && P.DateTimeStart <= DateTimeTo && fltMovies.Contains(M.MovieID) && fltTechTypes.Contains(TT.TechnologyTypeID) && CS.CinemaID == CinemaID group T by T.Seats into SeatGroup orderby SeatGroup.Count() descending select new { SeatLbl = SeatGroup.Key.CinemaHalls.Name + " - seat " + SeatGroup.Key.SeatRows.SeatRowLbl + SeatGroup.Key.SeatColumns.SeatColumnLbl.ToString(), SeatFreq = SeatGroup.Count() }).Take(10).ToDictionary(t => t.SeatLbl, t => t.SeatFreq); if (Frequency.Count == 0) { return(NotFound()); } return(Ok(Frequency)); }
public IHttpActionResult SeatReservationFrequencyReporting(ReportingParameters reportingParameters) { var CinemaID = reportingParameters.CinemaID; var TechTypeID = reportingParameters.TechTypeID; DateTime DateTimeFrom = reportingParameters.DateTimeFrom; DateTime DateTimeTo = reportingParameters.DateTimeTo; var fltTechTypes = new List <int>(); fltTechTypes.AddRange((TechTypeID == 0) ? principal.TechnologyTypes.Select(x => x.TechnologyTypeID).ToList() : principal.TechnologyTypes.Where(x => x.TechnologyTypeID == TechTypeID).Select(x => x.TechnologyTypeID).ToList()); var dctSeatReservationFrequency = (from T in principal.Tickets join P in principal.Projections on T.ProjectionID equals P.ProjectionID join M in principal.Movies on P.MovieID equals M.MovieID join G in principal.Genres on M.GenreID equals G.GenreID join TT in principal.TechnologyTypes on P.TechnologyTypeID equals TT.TechnologyTypeID join CHS in principal.CinemaHalls on P.CinemaHallID equals CHS.CinemaHallID join CS in principal.Cinemas on CHS.CinemaID equals CS.CinemaID where P.DateTimeStart >= DateTimeFrom && P.DateTimeStart <= DateTimeTo && fltTechTypes.Contains(TT.TechnologyTypeID) && CS.CinemaID == CinemaID group T by T.Seats into SeatGroup orderby SeatGroup.Count() descending select new { SeatID = SeatGroup.Key.SeatID, SeatLabel = SeatGroup.Key.SeatRows.SeatRowLbl + SeatGroup.Key.SeatColumns.SeatColumnLbl, CinemaHall = SeatGroup.Key.CinemaHalls.Name, TotalFrequency = SeatGroup.Count() }).Take(10) .ToDictionary(t => t.SeatID, t => new { SeatLabel = t.SeatLabel, CinemaHall = t.CinemaHall, TotalFrequency = t.TotalFrequency }); if (dctSeatReservationFrequency.Count == 0) { return(NotFound()); } return(Ok(dctSeatReservationFrequency)); }