public ActionResult DetailsForSpecifiedBooking(BookingDetails bookingDetails) { var roomBookings = from t in dbRoomBooking.RoomBookings select t; roomBookings = roomBookings.Where(r => r.BookingId == bookingDetails.booking.BookingId); //camerele ce aparti rezervarii curente List <Room> rooms = new List <Room>(); foreach (var roomB in roomBookings) { Room r = dbRoom.Rooms.Find(roomB.RoomId); rooms.Add(r); } bookingDetails.rooms = rooms; InvoiceFactory invoiceFact = InvoiceFactory.getInstance(); if (Request.Form["PDFInvoiceButton"] != null) { BookingInvoice e = invoiceFact.exportInvoice(InvoiceFactory.InvoiceTypes.PDF); e.export(bookingDetails); } else if (Request.Form["TxtInvoiceButton"] != null) { BookingInvoice e = invoiceFact.exportInvoice(InvoiceFactory.InvoiceTypes.TXT); Response.Write(e.export(bookingDetails)); Response.ContentType = "application/txt"; Response.AppendHeader("Content-Disposition", "attachment; filename=invoice.txt"); Response.End(); } return(RedirectToAction("BookingList")); }