public virtual async Task <IActionResult> Delete(int id) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageCampaigns)) { return(AccessDeniedView()); } //try to get a campaign with the specified id var campaign = await _campaignService.GetCampaignByIdAsync(id); if (campaign == null) { return(RedirectToAction("List")); } await _campaignService.DeleteCampaignAsync(campaign); //activity log await _customerActivityService.InsertActivityAsync("DeleteCampaign", string.Format(await _localizationService.GetResourceAsync("ActivityLog.DeleteCampaign"), campaign.Id), campaign); _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Promotions.Campaigns.Deleted")); return(RedirectToAction("List")); }
public async Task <IActionResult> DeleteConfirmed(int id) { var campaign = await _campaignService.GetCampaignByIdAsync(id); await _campaignService.DeleteCampaignAsync(campaign); return(RedirectToAction(nameof(Index))); }