public async Task <Unit> Handle(RemoveCalendarEventCommand command, CancellationToken cancellationToken) { var calendarEvent = await _calendarEventRepository.FindOne(command.Id); if (calendarEvent == null) { throw new ResourceNotFoundException(); } await _calendarEventRepository.Remove(calendarEvent); return(Unit.Value); }
public async Task <Unit> Handle(EditCalendarEventCommand command, CancellationToken cancellationToken) { var calendarEvent = await _calendarEventRepository.FindOne(command.Id); if (calendarEvent == null) { throw new ResourceNotFoundException(); } calendarEvent.Edit( command.Name, command.Time, command.Location, command.EventOrganizer ); calendarEvent.EditMembers(command.Members); await _calendarEventRepository.Save(calendarEvent); return(Unit.Value); }