public virtual async Task <IActionResult> Delete(int id) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageGiftCards)) { return(AccessDeniedView()); } //try to get a gift card with the specified id var giftCard = await _giftCardService.GetGiftCardByIdAsync(id); if (giftCard == null) { return(RedirectToAction("List")); } await _giftCardService.DeleteGiftCardAsync(giftCard); //activity log await _customerActivityService.InsertActivityAsync("DeleteGiftCard", string.Format(await _localizationService.GetResourceAsync("ActivityLog.DeleteGiftCard"), giftCard.GiftCardCouponCode), giftCard); _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.GiftCards.Deleted")); return(RedirectToAction("List")); }
public async Task TearDown() { await _giftCardService.DeleteGiftCardAsync(_giftCard1); await _giftCardService.DeleteGiftCardAsync(_giftCard2); }