Now let's move to the controllers used on the previous routes. The controllers need to be located at ReactiveWebStore/app/controllers
. Controllers are bound between views (UI), models and service, which are responsible for business operations. It's always important to separate UI logic, which tends to be specific, from business logic, which tends to be more generic, and often, way more important.
Let's have a look at the product controller in ProductController.scala
in the following code:
@Singleton class ProductController @Inject() (val messagesApi:MessagesApi,val service:IProductService) extends Controller with I18nSupport { val productForm: Form[Product] = Form( mapping( "id" -> optional(longNumber), "name" -> nonEmptyText, "details" -> text, "price" -> bigDecimal )(models.Product.apply)(models.Product.unapply)) ...