#include "DelCommand.h" #include "Error.h" #include "Manager.h" using util::Util; using util::Manager; using err::Error; namespace commands { DelCommand::DelCommand() : SubCommand("delete", 100, true) { } void DelCommand::run(int argc, stringstream& args) { Manager& mgr = Manager::get_instance(); const string data_type = Util::read_string(args); int id; args >> id; if (!args) throw Error(102, "Ein Parameter eines Befehls konnte nicht gelesen werden"); if (data_type == "user") mgr.del_user(id); else if (data_type == "task") mgr.del_task(id); else throw Error(101, "Befehl ist unbekannt."); mgr.save(); } } // commands