Beispiel #1
0
        protected void PrepareCampaignsToSave(IEnumerable <Campaign> items)
        {
            var entitiesWithoutCustomId = items.Where(e => e.CustomId == 0);

            var newIdentities = new Stack <int>(
                _identityGenerator.GetIdentities <CampaignNoIdentity>(
                    entitiesWithoutCustomId.Count()
                    ).Select(e => e.Id)
                );

            foreach (var campaign in entitiesWithoutCustomId)
            {
                campaign.CustomId = newIdentities.Pop();
            }

            foreach (var campaign in items)
            {
                campaign.UpdateDerivedKPIs();
            }
        }
Beispiel #2
0
 public void Add(Domain.Shared.SalesAreas.SalesArea salesArea)
 {
     salesArea.CustomId = _identityGenerator.GetIdentities <SalesAreaNoIdentity>(1).First().Id;
     _dbContext.Add(_mapper.Map <Entities.Tenant.SalesAreas.SalesArea>(salesArea),
                    post => post.MapTo(salesArea), _mapper);
 }