Ejemplo n.º 1
0
        public async Task <PackageResponse> SaveAsync(Package package)
        {
            try
            {
                await _packageRepository.AddAsync(package);

                await _unitOfWork.CompleteAsync();

                return(new PackageResponse(package));
            }
            catch (Exception e)
            {
                return(new PackageResponse($"An error ocurred while saving Package: {e.Message}"));
            }
        }
Ejemplo n.º 2
0
        public async Task <PackageResponse> SaveAsync(Package package)
        {
            try
            {
                await packageRepository.AddAsync(package);

                await unitOfWork.CompleteAsync();

                return(new PackageResponse(package));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new PackageResponse($"An error occurred when saving the package: {ex.Message}"));
            }
        }