private void resetCanSubAllocations(CanAllocation canAllocation) { //** If Update/Delete, remove existing sub-allocations */ if (canAllocation.CanAllocationId != 0 && canAllocation.CanSubAllocations != null) { foreach (var canSubAllocation in canAllocation.CanSubAllocations.Where(csa => csa.Status == Status.Active)) { canSubAllocation.Status = Status.Inactive; canSubAllocation.StatusUpdateDateTime = DateTime.UtcNow; canSubAllocation.StatusUpdateUserNEDId = "system"; canSubAllocation.LastUpdateDateTime = DateTime.UtcNow; canSubAllocation.LastUpdateUserNEDId = "system"; } } //** If Add/Update, add new sub-allocations */ if (canAllocation.Status == Status.Active) { if (canAllocation.CanSubAllocations == null) { canAllocation.CanSubAllocations = new List <CanSubAllocation>(); } //TBD: to implement insertion } }
public async void AddCanAllocation(CanAllocation canAllocation) { await _context.CanAllocations.AddAsync(canAllocation); }