public override void Update(ArCollectiveBilling entity) { var existingEntity = (from e in Entities.Include("ArCollectiveBillingLines") where e.CollectiveBillingId == entity.CollectiveBillingId select e).FirstOrDefault(); // Cannot Update if Entity Doesn't exists in database if (existingEntity == null) throw (new InvalidOperationException("Entity Doesnt exist in database")); if (existingEntity.Vers != entity.Vers) throw (new OptimisticConcurrencyException("Another user has updated the database")); // Update entity Vers and Audit Data field entity.LastModDateTime = DateTime.Now; entity.CreateDateTime = existingEntity.CreateDateTime; entity.CreateUser = existingEntity.CreateUser; entity.Vers = existingEntity.Vers + 1; // Update Standard Code Type existingEntity.Merge(entity); Entities.ApplyCurrentValues(existingEntity); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)