示例#1
0
        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);
        }
示例#2
0
        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());
            }
        }