public IActionResult AdDelete(int adID) { Advertisement dbEntry = ad_repository.DeleteAdvertisement(adID); if (TempData != null) { TempData["message"] = (dbEntry != null) ? $"{dbEntry.Description} was deleted" : "Failed to delete advertisement"; } return(RedirectToAction("AdIndex")); }
public ActionResult DeleteConfirmed(int id) { _repository.DeleteAdvertisement(id); try { _repository.SaveChanges(); } catch (Exception e) { return(RedirectToAction("Delete", new { id = id })); } return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteAdvertisement([FromBody] Guid id) { var _advertisement = await _advertisementRepository.DeleteAdvertisement(id); if (_advertisement == false) { return(NotFound("Anúncio não encontrado")); } else { return(Ok(_advertisement)); } }
public void Delete(int id) { _adPost.DeleteAdvertisement(id); }
public void DeleteAdvertisement(int id) { _advertisementRepository.DeleteAdvertisement(id); }