Exemplo n.º 1
0
 protected virtual Campaign UpdateCampaign(Campaign campaign)
 {
     using (var dbContext = GetDbContext())
     {
         var savedCampaign = dbContext.CampaignsSet.Single(cnt => cnt.ID == campaign.ID);
         savedCampaign.CopyPropertiesFrom(savedCampaign);
         return savedCampaign;
     }
 }
Exemplo n.º 2
0
 protected virtual Campaign CreateCampaign(Campaign campaign)
 {
     using (var dbContext = GetDbContext())
     {
         var savedCampaign = new Campaign {ID = GetNextCampaignId(dbContext)};
         dbContext.CampaignsSet.Add(savedCampaign);
         savedCampaign.CopyPropertiesFrom(campaign);
         return savedCampaign;
     }
 }
Exemplo n.º 3
0
 public Campaign CreateOrUpdateCampaign(Campaign campaign)
 {
     return campaign.IsNewEntity ? CreateCampaign(campaign) : UpdateCampaign(campaign);
 }
Exemplo n.º 4
0
 public void CopyPropertiesFrom(Campaign entity)
 {
     this.Title = entity.Title;
 }