Esempio n. 1
0
        public ActionResult Edit(int id, CampaignViewModel campaign)
        {
            try
            {
                campaignService.EditCampaign(campaign);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult Edit(int id, CampaignViewModel campaign)
        {
            try
            {
                var _company = ConfigurationSettings.AppSettings["company"];
                campaign.CompanyId = Int32.Parse(_company);
                campaignService.EditCampaign(campaign);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 3
0
        public IHttpActionResult PutCampaign(int id, CampaignViewModel campaign)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != campaign.Id)
            {
                return(Content(HttpStatusCode.BadRequest, "Invalid content data"));
            }

            if (campaignService.EditCampaign(campaign))
            {
                return(Ok(true));
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 4
0
        public ActionResult EditCampaign(CampaignSchedulesFormViewModel formCampaign)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var edited = Mapper.Map <CampaignSchedulesFormViewModel, Campaign>(formCampaign);

                    campaignService.EditCampaign(edited);
                    campaignService.CommitChanges();
                }
                else
                {
                    return(RedirectToAction("Create", new { id = formCampaign.ID }));
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(formCampaign));
            }
        }