public string AddEventForType(string type, string action, string description, string customer) { DataAccess da = new DataAccess(); if (da.TypeExist(type, customer)) { if (da.ActionExistForType(type, action, customer)) { return "'" + action + "' event already exist for " + type; } else { //Tilføjer event til en type if (da.AddEventForType(type, action, description, customer)) { return "'" + action + "' event added to " + type; } else { return "failed to add '" + action + "' for " + type; } } } else { //Lav typen af enhed hos kunden if (da.AddType(type, customer)) { //Tilføjer event til en type if (da.AddEventForType(type, action, description, customer)) { return "'" + action + "' event added to " + type; } else { return "failed to add '" + action + "' for " + type; } } else { return type + " type doesn't exist & failed to add it"; } } }