public string getAllBookings(string user, string flight) { var bookings = _adminBLL.getAllBookings(user, flight); var jsBookings = new List <JsBooking>(); foreach (Booking b in bookings) { var aBooking = new JsBooking() { Id = b.Id, UserId = b.User.Id, UserFirstname = b.User.Fornavn, UserLastname = b.User.Etternavn, FlightId = b.Flight.Id, FlightFrom = b.Flight.FromAirport.Name, FlightTo = b.Flight.ToAirport.Name, FlightDeparture = b.Flight.Departure.ToString("dd.MM.yyyy HH:mm"), Amount = b.Amount }; jsBookings.Add(aBooking); } var jsonSerializer = new JavaScriptSerializer(); return(jsonSerializer.Serialize(jsBookings)); }