public ReservatieStatus MakeReservations(List <Reservatie> reservatieList) { List <Voorstelling> gelukteList = new List <Voorstelling>(); List <Voorstelling> mislukteList = new List <Voorstelling>(); using (var entities = new CultuurHuisMVCEntities()) { foreach (var reservatie in reservatieList) { var voorstelling = entities.Voorstellingen.Find(reservatie.VoorstellingsNr); if (voorstelling.VrijePlaatsen >= reservatie.Plaatsen) { voorstelling.VrijePlaatsen -= reservatie.Plaatsen; gelukteList.Add(voorstelling); entities.Reservaties.Add(reservatie); entities.SaveChanges(); } else { mislukteList.Add(voorstelling); } } ReservatieStatus status = new ReservatieStatus { GelukteReservaties = gelukteList, MislukteReservaties = mislukteList, Reservaties = reservatieList }; return(status); } }
public Email(String header, String body, String footer, String subject, ReservatieStatus status) { this.Header = header; this.Body = body; this.Footer = footer; this.Subject = subject; this.Status = status; }
public ActionResult Bevestigen() { List <Voorstelling> voorstellingList = GetVoorstellingFromSession(); List <Reservatie> reservatieList = new List <Reservatie>(); foreach (var voorstelling in voorstellingList) { Reservatie reservatie = new Reservatie { KlantNr = ((Klant)Session["klant"]).KlantNr, VoorstellingsNr = voorstelling.VoorstellingsNr, Plaatsen = short.Parse(Session[voorstelling.VoorstellingsNr.ToString()].ToString()) }; reservatieList.Add(reservatie); } ReservatieStatus status = cultuurService.MakeReservations(reservatieList); foreach (var item in status.GelukteReservaties) { Session.Remove(item.VoorstellingsNr.ToString()); } return(View(status)); }
public Email FindByReservatieStatus(ReservatieStatus status) { return(emails.FirstOrDefault(e => e.Status == status)); }