Beispiel #1
0
        public async Task <ActionResult <AdEntity> > DeleteAdEntity(int id)
        {
            if (!AdEntityExists(id))
            {
                return(NotFound());
            }
            await _adService.DeleteAd(id, this.HttpContext);

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> DeleteJob(string id)
        {
            try
            {
                var userId = User.Claims.Where(x => x.Type == "id").FirstOrDefault().Value;
                var result = await _adService.DeleteAd(userId, id);

                if (!result.IsSuccess())
                {
                    return(result.ToErrorResponse());
                }
                return(Ok(result.Data));
            }
            catch (Exception)
            {
                return(BadRequest("Σφάλμα, Επικοινωνήστε με τον διαχειριστή"));
            }
        }
Beispiel #3
0
        public IActionResult Delete(int id)
        {
            var user = userManager.GetUserAsync(this.User).Result;

            if (user == null)
            {
                this.ViewData["errorMessage"] = "You do not have permision to this ad!";
                return(Redirect("/"));
            }
            var isAdmin  = userManager.IsInRoleAsync(user, "Administrator").Result;
            var isDelete = adService.DeleteAd(id, user, isAdmin);

            if (isDelete)
            {
                this.ViewData["successMessage"] = "Ad is successfully removed";
                return(Redirect("/"));
            }

            this.ViewData["errorMessage"] = "You do not have permision to this ad!";
            return(Redirect("/"));
        }
Beispiel #4
0
        public IActionResult Delete(DeleteAdDto dto)
        {
            var result = _adService.DeleteAd(dto);

            return(Json(result));
        }
Beispiel #5
0
        public async Task <IActionResult> DeleteAd(int id)
        {
            await adService.DeleteAd(id);

            return(this.Redirect(GlobalConstants.homeUrl));
        }
Beispiel #6
0
 public ActionResult PersonalAdsDelete(int AdId)
 {
     adService.DeleteAd(AdId);
     return(PartialView());
 }
Beispiel #7
0
        //[AdminAuthorize(Permissions = "admin.ad.delete")]
        public IActionResult Delete(Moz.Biz.Dtos.Ads.DeleteAdRequest request)
        {
            var resp = _adService.DeleteAd(request);

            return(RespJson(resp));
        }
 public void Delete(int id)
 {
     _adService.DeleteAd(id);
 }