// List gets all Contacts. This function is mapped to the path
// GET /contacts
List gets all Contacts. This function is mapped to the path
GET /contacts
// List gets all Contacts . This function is mapped to the path // GET / contacts
func (v ContactsResource) List(c buffalo.Context) error {
	tx := c.Value("tx").(*pop.Connection)
	contacts := &models.Contacts{}
	q := tx.PaginateFromParams(c.Params())
	if err := q.All(contacts); err != nil {
		return errors.WithStack(err)
	}
	c.Set("contacts", contacts)
	c.Set("pagination", q.Paginator)
	return c.Render(200, render.R.HTML("contacts/index.html"))
}
func ( v ContactsResource ) List ( c buffalo . Context ) error { tx := c . Value ( " " ) . ( * pop . Connection ) contacts := & models . Contacts { } q := tx . PaginateFromParams ( c . Params ( ) ) if err := q . All ( contacts ) ; err != nil { return errors . WithStack ( err ) } c . Set ( " " , contacts ) c . Set ( " " , q . Paginator ) return c . Render ( 200 , render . R . HTML ( " " ) ) }
List gets all Contacts.
List gets all Contacts .
// Get the DB connection from the context // Paginate results. Params "page" and "per_page" control pagination. // Default values are "page=1" and "per_page=20". // Retrieve all Contacts from the DB // Make Contacts available inside the html template // Add the paginator to the context so it can be used in the template.