public String inserTicket(String film, int rand, int loc, DateTime data) { List <Bilet> arr = new List <Bilet>(); arr = ticket.getTicket(film, data); int n; n = getNumberTickets(film, data); Console.WriteLine(n); if (!arr.Any()) { ticket.insertTicket(film, rand, loc, data); movie.updateMovie(film, "numarBilete", (n - 1).ToString(), data); n = n - 1; return("Bilet adaugat cu succes"); } else { foreach (Bilet t in arr) { if (n >= 1) { if (t.getLoc() == loc && t.getRand() == rand) { return("Loc ocupat"); } else { ticket.insertTicket(film, rand, loc, data); movie.updateMovie(film, "numarBilete", (n - 1).ToString(), data); n = n - 1; return("Bilet adaugat cu succes"); } } else { return("Nu mai sunt bilete disponibile"); } } } return(null); }
public void updateMovie(String titlu, String old, String up, DateTime oraZilnica) { movie.updateMovie(titlu, old, up, oraZilnica); }