예제 #1
0
        public async Task <DatabaseResponse> CreateProductsAsync(List <Product> products)
        {
            int result = await _productRepository.AddAllAsync(products);

            int status = 0;

            if (result > 0)
            {
                status = (int)DbReturnValue.CreateSuccess;
            }
            //if category exists to do
            // status = (int)DbReturnValue.RecordExists
            return(new DatabaseResponse {
                ResponseCode = status
            });
        }
예제 #2
0
        public async Task SaveAllEvents(IList <IVersionedEvent> uncommittedEvents, ITextSerializer textSerializer)
        {
            if (uncommittedEvents == null)
            {
                throw new ArgumentNullException(nameof(uncommittedEvents));
            }

            if (textSerializer == null)
            {
                throw new ArgumentNullException(nameof(textSerializer));
            }

            var serializedEvents =
                uncommittedEvents.Select(@event => GetSerializedEvent(@event, textSerializer)).ToList();

            await _eventStoreRepositoryService.AddAllAsync(serializedEvents);

            await _unitOfWork.SaveChangesAsync();
        }