import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
+import play.api.libs.concurrent.Execution.Implicits._
import java.io.FileInputStream
import forms._
+import models._
import models.services._
import controllers.services._
import beans._
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._
import scala.io.Source
+import scala.concurrent.Future
import java.io.File
import java.nio.file.Paths;
import java.nio.file.Files;
}
}
- def downLoad(key:String) = Action { implicit request =>
+ def downLoadFuture(key:String) = Action { implicit request =>
inTransaction {
- val row = Integer.decode(Messages("list.row"))
- val buff = PartManager().getByLikeName(key)
+ val futureOfBuff:Future[Query[Part]] = Future {
+ PartManager().getByLikeName(key)
+ }
val attachment = "attachment; filename=parts_master_download.csv"
- Ok(views.html.partsmastercsv(buff)).withHeaders(CONTENT_DISPOSITION -> attachment).as("text/csv")
+ Async {
+ futureOfBuff.map { fob =>
+ inTransaction {
+ Ok(views.html.partsmastercsv(fob)).withHeaders(CONTENT_DISPOSITION -> attachment).as("text/csv")
+ }
+ }
+ }
}
}
}
\ No newline at end of file