private void DeleteAd() { _adService.Delete(new Ad { IlanID = Convert.ToInt32(DgwIlan.SelectedCells[0].Value.ToString()), }); }
public void DeleteTest() { var count = _memoryDbContext.Ads.Count(); var ad = _memoryDbContext.Ads.FirstOrDefault(); Assert.IsTrue(_adService.Delete(ad.ID)); Assert.IsTrue(_memoryDbContext.Ads.Count() == count - 1); }
public ActionResult DeleteAd(int adId, string returnUrl) { var adsResult = _adProvider.Delete(adId); if (adsResult.IsNone()) { return(RedirectToAction("GetAdList", "Ad")); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }
public async Task <IActionResult> Delete(int id) { try { return(HttpResponse.Send(true, 200, await _adService.Delete(id))); } catch (AppException ex) { return(HttpResponse.Send(false, ex.Code, null, ex.Message)); } }
public IActionResult DeleteAd(int id) { if (_adService.Delete(id)) { return(Ok()); } else { return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public IActionResult Delete(int id) { try { var userId = User.GetUserId(); _adService.Delete(id, userId); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message })); } return(Json(new { success = true })); }
public async Task <IActionResult> Delete(Guid adId) { var userId = User.Claims.GetUserId(); try { await _adService.Delete(adId, userId); } catch (UnauthorizedAccessException) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public IActionResult DeleteConfirmed(Guid id) { if (id == null) { return(NotFound().WithError(LOCALIZATION_ERROR_NOT_FOUND)); } try { _adService.Delete(id); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(RedirectToAction(nameof(Index)).WithError(ex.Message)); } return(RedirectToAction(nameof(MyAds)).WithSuccess(LOCALIZATION_SUCCESS_DEFAULT)); }