/// <summary> /// Updates an existing item in the database. /// </summary> /// <param name="entity"> /// The entity. /// </param> protected override void PersistUpdatedItem(IOrder entity) { ((Entity)entity).UpdatingEntity(); var factory = new OrderFactory(entity.Items); var dto = factory.BuildDto(entity); Database.Update(dto); _orderLineItemRepository.SaveLineItem(entity.Items, entity.Key); entity.ResetDirtyProperties(); }
/// <summary> /// Updates an existing item in the database. /// </summary> /// <param name="entity"> /// The entity. /// </param> protected override void PersistUpdatedItem(IOrder entity) { ((Entity)entity).UpdatingEntity(); var factory = new OrderFactory(entity.Items); var dto = factory.BuildDto(entity); Database.Update(dto); _orderLineItemRepository.SaveLineItem(entity.Items, entity.Key); entity.ResetDirtyProperties(); RuntimeCache.ClearCacheItem(Cache.CacheKeys.GetEntityCacheKey <IInvoice>(entity.InvoiceKey)); }
/// <summary> /// Saves a new item to the databse. /// </summary> /// <param name="entity"> /// The entity. /// </param> protected override void PersistNewItem(IOrder entity) { ((Entity)entity).AddingEntity(); var factory = new OrderFactory(entity.Items); var dto = factory.BuildDto(entity); Database.Insert(dto); entity.Key = dto.Key; Database.Insert(dto.OrderIndexDto); ((Order)entity).ExamineId = dto.OrderIndexDto.Id; _orderLineItemRepository.SaveLineItem(entity.Items, entity.Key); entity.ResetDirtyProperties(); }