Beispiel #1
0
        public bool DeleteEventType(int id, out string response)
        {
            EventType toRemove = EventTypes.GetEventTypeWithEvents(id);

            if (toRemove == null)
            {
                response = $"Cannot delete Event Type: No Event Type with id {id} was found.";
                return(false);
            }
            else if (toRemove.Events.Count() > 0)
            {
                response = $"Cannot delete Event Type: Event Type has Events assigned.";
                return(false);
            }
            try
            {
                EventTypes.Remove(toRemove);
                Complete();
                response = "Event Type deleted.";
                return(true);
            }
            catch (Exception ex)
            {
                response = ex.Message;
                return(false);
            }
        }