public async Task <string> InsertPresidentAsync(PresidentBuilder builder) { var president = builder.Build(); if (Notification.HasNotification()) { return(""); } var id = await _whiteHouseRepository.InsertPresidentsAsync(president); // Trigger president created event _eventBus.Trigger(new PresidentCreatedEvent(president)); return(id); }
public async Task UpdatePresidentAsync(PresidentBuilder builder) { var president = builder.Build(); if (Notification.HasNotification()) { return; } var data = await _whiteHouseRepository.UpdatePresidentsAsync(president); if (data == null) { Notification.Raise(NotificationEvent.DefaultBuilder .WithNotFoundStatus() .WithMessage(AppConsts.LocalizationSourceName, President.Error.CouldNotFindPresident) .Build()); } }