server/controllers/portfolio.js
/**
   * Edit, edit page and update action
   *
   * Record is preloaded in context loader by default and is avaible as res.locals.data
   *
   * @param  {Object} req express.js request
   * @param  {Object} res express.js response
   *
   * @api [update|put] /portfolio/{portfolioId}
   * description: "Update one portfolio"
   * responses:
   *   "200":
   *     description: "Update one by id portfolio success"
   *     schema:
   *       type: object
   *       properties:
   *         portfolio:
   *           $ref: "#/definitions/portfolio"
   */
Edit, edit page and update action
Record is preloaded in context loader by default and is avaible as res.locals.data

@param  {Object} req express.js request
@param  {Object} res express.js response


Edit edit page and update action Record is preloaded in context loader by default and is avaible as res . locals . data @param { Object } req express . js request @param { Object } res express . js response
edit(req, res) {
    if (!res.locals.template) {
      res.locals.template = res.local.model + '/' + 'edit';
    }
    let record = res.locals.data;
    if (req.we.config.updateMethods.indexOf(req.method) >-1) {
      if (!record) {
        return res.notFound();
      }
      record.update(req.body)
      .then(function reloadAssocs(n) {
        return n.reload()
        .then(function() {
          return n;
        });
      })
      .then(function afterUpdate (newRecord) {
        res.locals.data = newRecord;
        res.updated();
        return null;
      })
      .catch(res.queryError);
    } else {
      res.redirect('/admin/#/portfolio/'+record.id);
    }
  }
edit ( req , res ) { if ( ! res . locals . template ) { res . locals . template = res . local . model + '/' + 'edit' ; } let record = res . locals . data ; if ( req . we . config . updateMethods . indexOf ( req . method ) > - 1 ) { if ( ! record ) { return res . notFound ( ) ; } record . update ( req . body ) . then ( function reloadAssocs ( n ) { return n . reload ( ) . then ( function ( ) { return n ; } ) ; } ) . then ( function afterUpdate ( newRecord ) { res . locals . data = newRecord ; res . updated ( ) ; return null ; } ) . catch ( res . queryError ) ; } else { res . redirect ( '/admin/#/portfolio/' + record . id ) ; } }
Edit, edit page and update action
 Record is preloaded in context loader by default and is avaible as res.locals.data
Edit edit page and update action Record is preloaded in context loader by default and is avaible as res . locals . data
// send the admin or editor to admin edit content page: