예제 #1
0
 private void DeleteAd()
 {
     _adService.Delete(new Ad
     {
         IlanID = Convert.ToInt32(DgwIlan.SelectedCells[0].Value.ToString()),
     });
 }
예제 #2
0
        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);
        }
예제 #3
0
        public ActionResult DeleteAd(int adId, string returnUrl)
        {
            var adsResult = _adProvider.Delete(adId);

            if (adsResult.IsNone())
            {
                return(RedirectToAction("GetAdList", "Ad"));
            }
            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
예제 #4
0
 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));
     }
 }
예제 #5
0
 public IActionResult DeleteAd(int id)
 {
     if (_adService.Delete(id))
     {
         return(Ok());
     }
     else
     {
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
예제 #6
0
        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 }));
        }
예제 #7
0
        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"));
        }
예제 #8
0
        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));
        }