public async Task <IActionResult> DeleteConfirmed(int id) { var coupon = await _couponService.GetCouponByIdAsync(id); await _couponService.DeleteCouponAsync(coupon); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteCoupon(string couponCode) { try { await _couponService.DeleteCouponAsync(couponCode); return(NoContent()); } catch (NotFoundException ex) { return(NotFound(ex.Message)); } catch (BadRequestException ex) { return(BadRequest(ex.Message)); } catch (Exception ex) { _logger.LogCritical($"DeleteCoupon() error {ex}"); return(StatusCode(500, "Internal Server Error: " + ex.Message)); } }
public async Task <IActionResult> DeleteConfirmed(Guid id) { await _couponService.DeleteCouponAsync(id); return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult> Detele(Guid couponId) { await _couponService.DeleteCouponAsync(couponId); return(Ok()); }