Esempio n. 1
0
        public virtual IActionResult Delete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCampaigns))
            {
                return(AccessDeniedView());
            }

            var campaign = _campaignService.GetCampaignById(id);

            if (campaign == null)
            {
                //No campaign found with the specified id
                return(RedirectToAction("List"));
            }

            _campaignService.DeleteCampaign(campaign);

            //activity log
            _customerActivityService.InsertActivity("DeleteCampaign",
                                                    string.Format(_localizationService.GetResource("ActivityLog.DeleteCampaign"), campaign.Id), campaign);

            SuccessNotification(_localizationService.GetResource("Admin.Promotions.Campaigns.Deleted"));

            return(RedirectToAction("List"));
        }
        public IActionResult DeleteConfirmed(long id)
        {
            CampaignService.DeleteCampaign(id);
            CampaignService.SaveCampaign();

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public IActionResult DeleteConfirmed(long id)
        {
            var campaign = campaignService.GetCampaignsWithRelated().FirstOrDefault(c => c.Id == id);

            campaign.ProductCampaign.Clear();
            campaign.CategoryCampaign.Clear();
            campaignService.DeleteCampaign(id);
            campaignService.SaveCampaign();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
 public IHttpActionResult DeleteCampaign(int id)
 {
     if (campaignService.DeleteCampaign(id))
     {
         return(Ok(true));
     }
     else
     {
         return(Content(HttpStatusCode.BadRequest, "Can't delete"));
     }
 }
        public async Task <IHttpActionResult> Delete(Guid id)
        {
            var campaign = await _campaignService.GetCampaign(id).ConfigureAwait(false);

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

            await _campaignService.DeleteCampaign(id).ConfigureAwait(false);

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 6
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                campaignService.DeleteCampaign(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 7
0
        public ActionResult DeleteConfirmed(int id)
        {
            var campaign = _campaignService.GetCampaignById(id);

            if (campaign != null)
            {
                _campaignService.DeleteCampaign(campaign);

                NotifySuccess(T("Admin.Promotions.Campaigns.Deleted"));
            }

            return(RedirectToAction("List"));
        }
Esempio n. 8
0
        public ActionResult DeleteCampaign(PagerParameters pagerParameters, int id)
        {
            if (_campaignService.DeleteCampaign(id))
            {
                Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Information, T("The campaign was deleted successfully!"));
            }
            else
            {
                Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Error, T("The company could not be removed. Try again!"));
            }

            return(this.RedirectToAction("Index", new { pagerParameters = pagerParameters }));
        }
Esempio n. 9
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCampaigns))
            {
                return(AccessDeniedView());
            }

            var campaign = _campaignService.GetCampaignById(id);

            if (campaign == null)
            {
                throw new ArgumentException("No campaign found with the specified id", "id");
            }
            _campaignService.DeleteCampaign(campaign);

            SuccessNotification(_localizationService.GetResource("Admin.Promotions.Campaigns.Deleted"));
            return(RedirectToAction("List"));
        }
Esempio n. 10
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCampaigns))
            {
                return(AccessDeniedView());
            }

            var campaign = _campaignService.GetCampaignById(id);

            if (campaign == null)
            {
                return(RedirectToAction("List"));
            }

            _campaignService.DeleteCampaign(campaign);

            NotifySuccess(_localizationService.GetResource("Admin.Promotions.Campaigns.Deleted"));
            return(RedirectToAction("List"));
        }
        public IActionResult Delete(string id)
        {
            var campaign = _campaignService.GetCampaignById(id);

            if (campaign == null)
            {
                //No campaign found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                _campaignService.DeleteCampaign(campaign);
                SuccessNotification(_localizationService.GetResource("Admin.Promotions.Campaigns.Deleted"));
                return(RedirectToAction("List"));
            }
            ErrorNotification(ModelState);
            return(RedirectToAction("Edit", new { id = id }));
        }
Esempio n. 12
0
        public async Task <IActionResult> Delete(string id)
        {
            var campaign = await _campaignService.GetCampaignById(id);

            if (campaign == null)
            {
                //No campaign found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                await _campaignService.DeleteCampaign(campaign);

                Success(_translationService.GetResource("admin.marketing.Campaigns.Deleted"));
                return(RedirectToAction("List"));
            }
            Error(ModelState);
            return(RedirectToAction("Edit", new { id = id }));
        }
        public async Task <IActionResult> DeleteCampaign(int id)
        {
            try
            {
                var campaign = await _campaignService.GetCampaignById(id);

                if (campaign == null)
                {
                    return(BadRequest(new ApiResponse(400, "Campaign is not existing.")));
                }

                await _campaignService.DeleteCampaign(campaign);

                return(Ok(new ApiResponse(200, "Success")));
            }
            catch
            {
                return(BadRequest(new ApiResponse(400, "Something went wrong.")));
            }
        }
Esempio n. 14
0
 public CampaignViewModel Delete(int campaignId)
 {
     CampaignService.SetUser(User);
     return(CampaignService.DeleteCampaign(campaignId));
 }
Esempio n. 15
0
 /// <summary>
 /// Deleted a queued email
 /// </summary>
 /// <param name="campaign">Campaign</param>
 public void DeleteCampaign(Campaign campaign)
 {
     _campaignService.DeleteCampaign(campaign);
 }