public virtual CustomerOrder Create(CustomerOrder order) { _eventPublisher.Publish(new OrderChangeEvent(EntryState.Added, null, order)); EnsureThatAllOperationsHasNumber(order); //TODO: for approved sipments need decrease inventory var orderEntity = order.ToDataModel(); CustomerOrder retVal = null; using (var repository = _repositoryFactory()) { repository.Add(orderEntity); CommitChanges(repository); } retVal = GetById(orderEntity.Id); return retVal; }
public virtual CustomerOrder Create(CustomerOrder order) { EnsureThatAllOperationsHaveNumber(order); _eventPublisher.Publish(new OrderChangeEvent(EntryState.Added, order, order)); var pkMap = new PrimaryKeyResolvingMap(); var entity = order.ToDataModel(pkMap); using (var repository = _repositoryFactory()) { repository.Add(entity); CommitChanges(repository); pkMap.ResolvePrimaryKeys(); } _dynamicPropertyService.SaveDynamicPropertyValues(order); var retVal = GetById(entity.Id, CustomerOrderResponseGroup.Full); return retVal; }