/// <summary> /// Creates a new instance of a workshop-Calendar for the specified date. /// </summary> /// <param name="date">The date to create the Calendar for.</param> public static WorkshopCalendarAggregateRoot Create(DateTime date) { //CreateMaintenancePlan command = new CreateMaintenancePlan(Guid.NewGuid(), date); WorkshopCalendarAggregateRoot calendar = new WorkshopCalendarAggregateRoot(date); WorkshopCalendarCreated createEvent = new WorkshopCalendarCreated(Guid.NewGuid(), date); calendar.RaiseEvent(createEvent); return(calendar); }
private async Task <bool> HandleCommand(int newVersion, WorkshopCalendarCreated newEvent) { WorkshopCalendar calendar = new WorkshopCalendar() { Date = newEvent.Date.ToString("yyyy-MM-dd"), CurrentVersion = newVersion }; try { await _context.WorkshopPlans.InsertOneAsync(calendar); return(true); } catch (Exception ex) { throw ex; } }
private void Handle(WorkshopCalendarCreated e) { Jobs = new List <MaintenanceJob>(); }