Example #1
0
 public bool UpdateEventType(int eventTypeId, string eventTypeName, out string response)
 {
     if (EventTypes.ValueIsInUseByIdForExpression(x => x.EventTypeName == eventTypeName && x.Id != eventTypeId))
     {
         response = $"An Event Type named {eventTypeName} already exists.";
         return(false);
     }
     try
     {
         EventType toUpdate = EventTypes.Get(eventTypeId);
         toUpdate.UpdateEventTypeName(eventTypeName);
         Complete();
         response = "Event Type added.";
         return(true);
     }
     catch (Exception ex)
     {
         response = ex.Message;
         return(false);
     }
 }
Example #2
0
 public bool CreateEventType(string eventTypeName, out string response)
 {
     if (EventTypes.ValueIsInUseByIdForExpression(x => x.EventTypeName == eventTypeName))
     {
         response = $"An Event Type with name {eventTypeName} already exists.";
         return(false);
     }
     try
     {
         EventType toAdd = new EventType(eventTypeName);
         EventTypes.Add(toAdd);
         Complete();
         response = "Event Type added.";
         return(true);
     }
     catch (Exception ex)
     {
         response = ex.Message;
         return(false);
     }
 }