public void CampaignCreateTest() { var campaign = new Campaign { Name = "Campaign1", Description = "Description1", StartDate = _createTestDate, EndDate = _createTestDate, }; campaign.Metadata.CampaignType = "Universal"; campaign.Metadata.CampaignData = "Some campaign data"; Repository.Data.Save(campaign); Assert.True(campaign.Id != Guid.Empty); var campaign1 = Repository.Data.Get<Campaign>(campaign.Id); Assert.True (campaign1.Metadata.CampaignType.Equals("Universal")); Assert.True (campaign1.Metadata.CampaignData.Equals ("Some campaign data")); }
public ActionResult SaveUpdateCampaign(Guid campaignId) { var campaign = new Campaign(); if (TryUpdateModel(campaign)) { campaign.Metadata.Data = CampaignModelHelper.ModelHelper.ConcreteCampaign; campaign.Metadata.CampaignType = CampaignModelHelper.ModelHelper.EditedCampaignType; if (campaignId != Guid.Empty) { var campaignEntity = Repository.Data.Get<Campaign>(campaignId); campaignEntity.Name = campaign.Name; campaignEntity.StartDate = campaign.StartDate; campaignEntity.EndDate = campaign.EndDate; campaignEntity.Active = campaign.Active; campaignEntity.Metadata.Data = campaign.Metadata.Data; campaignEntity.Metadata.CampaignType = campaign.Metadata.CampaignType; Repository.Data.Save(campaignEntity); } else { Repository.Data.Save(campaign); } } return Index(); }