more on sellers
This commit is contained in:
parent
37ae599c80
commit
94edacc6e6
2 changed files with 16 additions and 1 deletions
|
@ -21,3 +21,17 @@ inline void Seller::setLastName(const std::string& lastName) { lastName_ = lastN
|
||||||
inline void Seller::setNumberOfOfferedArticles(int number) { numberOfOfferedArticles_ = number; }
|
inline void Seller::setNumberOfOfferedArticles(int number) { numberOfOfferedArticles_ = number; }
|
||||||
|
|
||||||
inline size_t Seller::getNumberOfOfferedArticles() { return articles_.size(); }
|
inline size_t Seller::getNumberOfOfferedArticles() { return articles_.size(); }
|
||||||
|
|
||||||
|
std::vector<Article> Seller::getArticles(bool onlySold) {
|
||||||
|
if (onlySold) {
|
||||||
|
std::vector<Article> soldArticles;
|
||||||
|
for (auto article: articles_) {
|
||||||
|
if (article.isSold()) {
|
||||||
|
soldArticles.push_back(article);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return soldArticles;
|
||||||
|
} else {
|
||||||
|
return articles_;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ class Seller : public Entity
|
||||||
void setFirstName(const std::string& firstName);
|
void setFirstName(const std::string& firstName);
|
||||||
void setLastName(const std::string& lastName);
|
void setLastName(const std::string& lastName);
|
||||||
void setNumberOfOfferedArticles(int number);
|
void setNumberOfOfferedArticles(int number);
|
||||||
|
std::vector<Article> getArticles(bool onlySold = false);
|
||||||
|
|
||||||
size_t getNumberOfOfferedArticles();
|
size_t getNumberOfOfferedArticles();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue