package models.services
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._
import models._
case class UserManager() {
  def userList(request: play.api.mvc.Request[play.api.mvc.AnyContent]): String = {
      var userList:String = ""
      inTransaction {
        val users = PartsListDb.users.where(u => u.name like request.getQueryString("q").get + "%")
        for(user <- users) {
          userList = userList.concat(user.name)
          userList = userList.concat("\n")
         }
       }
      return userList
  }
  
  def getByName(name: String):User = {
    PartsListDb.users.where(u => u.name === name).head
  }

}