Closed gbenziv closed 3 years ago
This base class should contain all the generic member data and functions of a controller.
Notable things to house in the base class:
typedef std::map<std::string, std::string> ValidationErrors; std::shared_ptr<D> mDataProvider; std::shared_ptr<V> mView; void dumpValidationResult(const ValidationErrors& validationErrors) const; void save(const std::string& id) { // Decide if it's a create or update request if (isExists(customer.ID())) { update(customer); } else { create(customer); } } Move get, list, update, create and remove Cache operations std::vector<E> mCachedList; bool isExists(const std::string& barcode); std::vector<entity::Product>::iterator find(const std::string& barcode);
This base class should contain all the generic member data and functions of a controller.
Notable things to house in the base class: