public static async Task <Notice> GetNotice(this Event self, Instant occurrence, Event.Rule rule) { foreach (Event.Notice notice in self.Notices) { if (notice.Start.IsApproximately(occurrence)) { return(new Notice(self, notice, rule)); } } // no notice for this occurrence, create one. Event.Notice newNotice = new Event.Notice(); newNotice.Start = occurrence; self.Notices.Add(newNotice); await EventsService.SaveEvent(self); return(new Notice(self, newNotice, rule)); }
public Notice(Event evt, Event.Notice notice, Event.Rule rule) { this.Event = evt; this.EventNotice = notice; this.Rule = rule; }