public async Task <IActionResult> Delete(int id) { var auction = await _auctionFacade.GetAuctionAsync(id); if (auction == null) { throw new InvalidOperationException("Can't delete non-existing auction."); } if (auction.CreatedBy != User.Identity.Name) { throw new UnauthorizedAccessException("Can't delete auctions that you don't own."); } await _auctionFacade.DeleteAuction(id); return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> Delete(int Id) { await _auctionFacade.DeleteAuction(Id); return(RedirectToAction("Index", "Home")); }