public HttpResponseMessage AddAward( AddAwardPostData postData )
        {
            Campaign campaign = CampaignService.Instance.Get( postData.StoreId, postData.CampaignId );
              if ( campaign == null ) return null;

              IAward award = AwardService.Instance.Get( postData.AwardAlias );
              if ( award == null ) return null;

              campaign.Awards.Add( award );
              campaign.Save();

              HttpResponseMessage response = Request.CreateResponse( HttpStatusCode.OK );
              response.Content = new StringContent( award.ToJson(), Encoding.UTF8, "application/json" );
              return response;
        }
Example #2
0
        public HttpResponseMessage AddAward(AddAwardPostData postData)
        {
            Campaign campaign = CampaignService.Instance.Get(postData.StoreId, postData.CampaignId);

            if (campaign == null)
            {
                return(null);
            }

            IAward award = AwardService.Instance.Get(postData.AwardAlias);

            if (award == null)
            {
                return(null);
            }

            campaign.Awards.Add(award);
            campaign.Save();

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent(award.ToJson(), Encoding.UTF8, "application/json");
            return(response);
        }