Beispiel #1
0
        public ActionResult <CampaignDto> CreateCampaign([FromBody] CreateCampaignDto createCampaignDto)
        {
            var newCampaign = _campaignMapper.ToDto(
                _campaignService.AddCampaign(
                    _campaignMapper.ToNewDomain(createCampaignDto)));

            return(Created($"api/campaign/{newCampaign.Id}", newCampaign));
        }
Beispiel #2
0
        public IHttpActionResult PostCampaign(CampaignViewModel campaign)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (campaignService.AddCampaign(campaign))
            {
                return(Ok(campaign));
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, "Campaign already exists"));
            }
        }
        public ActionResult Create(CampaignViewModel campaign)
        {
            try
            {
                var _company = ConfigurationSettings.AppSettings["company"];
                campaign.CompanyId = Int32.Parse(_company);

                campaignService.AddCampaign(campaign);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #4
0
        public ActionResult Create(CampaignViewModel campaign)
        {
            try
            {
                string companyId = (System.Web.HttpContext.Current.Session["companyId"] as string);
                if (companyId != null)
                {
                    campaign.CompanyId = int.Parse(companyId);
                }
                campaignService.AddCampaign(campaign);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #5
0
 public void Order(Gamer gamer, ICampaignService campaign)
 {
     _campaignService.AddCampaign();
     Console.WriteLine("Order is successfull by " + gamer.FirstName);
 }