public async Task <PartnerResponse> SaveAsync(Partner partner)
        {
            try
            {
                await _partnerRepository.AddAsync(partner);

                await _unitOfWork.CompleteAsync();

                return(new PartnerResponse(partner));
            }
            catch (Exception ex)
            {
                return(new PartnerResponse($"An error ocurred while saving the partner: {ex.Message}"));
            }
        }
Ejemplo n.º 2
0
        public async Task ExecuteAsync(CreatePartnerCommand command)
        {
            if (!command.Validate())
            {
                AddNotification(command.GetNotifications());
                return;
            }

            try
            {
                await partnerRepository.AddAsync(command.Partner);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message, ex);
                AddNotification(ex.Message, System.Net.HttpStatusCode.InternalServerError);
            }
        }