示例#1
0
        //[ResponseType(typeof(bool))]
        public async Task <IHttpActionResult> CreateAsync([FromBody] IncentiveCampaignCreate incentiveCampaignCreate)
        {
            var campaignEntity =
                TypeAdapter.Adapt <IncentiveCampaignCreate, IncentiveCampaignEntity>(incentiveCampaignCreate);

            campaignEntity.UserName = "******";

            var entity = await Task.Run(() => incentiveCampaignApl.Create(campaignEntity));

            return(this.Ok());
        }
        public async Task <IHttpActionResult> Update([FromBody] IncentiveCampaignCreate incentiveCampaignCreate)
        {
            var incentiveCampaignEntity = new IncentiveCampaignCreate()
                                          .ToIncentiveCampaignEntity(incentiveCampaignCreate);

            var entity = await Task.Run(() => incentiveCampaignApl.Update(incentiveCampaignEntity));

            var summary =
                TypeAdapter.Adapt <IncentiveCampaignEntity, IncentiveCampaignSummary>(entity);

            return(this.Ok(summary));
        }
        public IncentiveCampaignSummary ToSummary(IncentiveCampaignCreate c)
        {
            var ret = new IncentiveCampaignSummary
            {
                Id                    = c.Id,
                Name                  = c.Name,
                StartDate             = c.StartDate,
                EndDate               = c.EndDate,
                AgreementLetterNeeded = c.AgreementLetterNeeded,
            };

            return(ret);
        }
        public async Task <IHttpActionResult> CreateAsync([FromBody] IncentiveCampaignCreate incentiveCampaignCreate)
        {
            var username = 1234;

            var incentiveCampaignEntity = new IncentiveCampaignCreate()
                                          .ToIncentiveCampaignEntity(incentiveCampaignCreate);

            incentiveCampaignEntity.Dealerships = new DealershipSummary()
                                                  .ToDealershipEntity(incentiveCampaignCreate.Dealerships);

            var entidade =
                TypeAdapter.Adapt <IncentiveCampaignCreate, IncentiveCampaignEntity>(incentiveCampaignCreate);

            var entity = await Task.Run(() => incentiveCampaignApl.Create(incentiveCampaignEntity));

            var retorno =
                TypeAdapter.Adapt <IncentiveCampaignEntity, IncentiveCampaignCreate>(entity);

            return(this.Ok(retorno));
        }