Edit mapper methods
This commit is contained in:
parent
bb167617bf
commit
f62131f832
@ -125,26 +125,32 @@
|
|||||||
{
|
{
|
||||||
var campaignDto = new CampaignDTO
|
var campaignDto = new CampaignDTO
|
||||||
{
|
{
|
||||||
|
Id = campaign.Id,
|
||||||
Description = campaign.Description,
|
Description = campaign.Description,
|
||||||
From = campaign.From,
|
From = campaign.From,
|
||||||
To = campaign.To,
|
To = campaign.To,
|
||||||
Url = campaign.Url,
|
Url = campaign.Url,
|
||||||
};
|
};
|
||||||
|
|
||||||
campaign.Rules.ForEach(c =>
|
campaign.Rules.ForEach(rule =>
|
||||||
{
|
{
|
||||||
switch (RuleType.From(c.RuleTypeId))
|
var ruleDto = new RuleDTO
|
||||||
|
{
|
||||||
|
Id = rule.Id,
|
||||||
|
RuleTypeId = rule.RuleTypeId,
|
||||||
|
Description = rule.Description,
|
||||||
|
CampaignId = rule.CampaignId
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (RuleType.From(rule.RuleTypeId))
|
||||||
{
|
{
|
||||||
case RuleTypeEnum.UserLocationRule:
|
case RuleTypeEnum.UserLocationRule:
|
||||||
var userLocationRule = c as UserLocationRule;
|
var userLocationRule = rule as UserLocationRule;
|
||||||
campaignDto.Rules.Add(new RuleDTO
|
ruleDto.LocationId = userLocationRule.LocationId;
|
||||||
{
|
|
||||||
LocationId = userLocationRule.LocationId,
|
|
||||||
RuleTypeId = userLocationRule.RuleTypeId,
|
|
||||||
Description = userLocationRule.Description
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
campaignDto.Rules.Add(ruleDto);
|
||||||
});
|
});
|
||||||
|
|
||||||
return campaignDto;
|
return campaignDto;
|
||||||
@ -154,22 +160,24 @@
|
|||||||
{
|
{
|
||||||
var campaingModel = new Campaign
|
var campaingModel = new Campaign
|
||||||
{
|
{
|
||||||
|
Id = campaignDto.Id,
|
||||||
Description = campaignDto.Description,
|
Description = campaignDto.Description,
|
||||||
From = campaignDto.From,
|
From = campaignDto.From,
|
||||||
To = campaignDto.To,
|
To = campaignDto.To,
|
||||||
Url = campaignDto.Url
|
Url = campaignDto.Url
|
||||||
};
|
};
|
||||||
|
|
||||||
campaignDto.Rules.ForEach(c =>
|
campaignDto.Rules.ForEach(ruleDto =>
|
||||||
{
|
{
|
||||||
switch (RuleType.From(c.RuleTypeId))
|
switch (RuleType.From(ruleDto.RuleTypeId))
|
||||||
{
|
{
|
||||||
case RuleTypeEnum.UserLocationRule:
|
case RuleTypeEnum.UserLocationRule:
|
||||||
campaingModel.Rules.Add(new UserLocationRule
|
campaingModel.Rules.Add(new UserLocationRule
|
||||||
{
|
{
|
||||||
LocationId = c.LocationId.Value,
|
Id = ruleDto.Id,
|
||||||
RuleTypeId = c.RuleTypeId,
|
LocationId = ruleDto.LocationId.Value,
|
||||||
Description = c.Description,
|
RuleTypeId = ruleDto.RuleTypeId,
|
||||||
|
Description = ruleDto.Description,
|
||||||
Campaign = campaingModel
|
Campaign = campaingModel
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user