コード例 #1
0
        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"));
        }
コード例 #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     _repository.DeleteAdvertisement(id);
     try
     {
         _repository.SaveChanges();
     }
     catch (Exception e)
     {
         return(RedirectToAction("Delete", new { id = id }));
     }
     return(RedirectToAction("Index"));
 }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
 public void Delete(int id)
 {
     _adPost.DeleteAdvertisement(id);
 }
コード例 #5
0
 public void DeleteAdvertisement(int id)
 {
     _advertisementRepository.DeleteAdvertisement(id);
 }