コード例 #1
0
 public bool CreateEventSeries(string title, string description, out string response)
 {
     if (EventSeries.ValueIsInUseByIdForExpression(x => x.Title == title))
     {
         response = $"An Event Series with the name {title} already exists.";
         return(false);
     }
     try
     {
         EventSeries toAdd = new EventSeries(title, description);
         EventSeries.Add(toAdd);
         Complete();
         response = "Event Series added";
         return(true);
     }
     catch (Exception ex)
     {
         response = ex.Message;
         return(false);
     }
 }
コード例 #2
0
        public bool UpdateEventSeries(int eventSeriesId, string title, string description, out string response)
        {
            EventSeries toUpdate = EventSeries.Get(eventSeriesId);

            if (EventSeries.ValueIsInUseByIdForExpression(x => x.Title == title && x.Id != eventSeriesId))
            {
                response = $"Cannot update Event Series: Title is in use by another Series.";
                return(false);
            }
            try
            {
                toUpdate.UpdateTitle(title);
                toUpdate.UpdateDescription(description);
                Complete();
                response = "Event Series updated.";
                return(true);
            }
            catch (Exception ex)
            {
                response = ex.Message;
                return(false);
            }
        }