コード例 #1
0
        public IActionResult Delete(int advertId)
        {
            advertRepository.DeleteAdvert(advertId);

            flashMessage.Confirmation("Ogłoszenie zostało usunięte");
            return(RedirectToAction(nameof(AdvertController.List), nameof(AdvertController).Replace("Controller", "")));
        }
コード例 #2
0
        public async Task <IHttpActionResult> DeleteAdvert(int id)
        {
            Advert advert = await _advertRepository.GetAdvertByID(id);

            if (advert == null)
            {
                return(NotFound());
            }

            _advertRepository.DeleteAdvert(id);
            await _advertRepository.SaveAsync();

            return(Ok());
        }
コード例 #3
0
 public IActionResult Delete(int id)
 {
     _advertRepository.DeleteAdvert(id);
     return(new OkResult());
 }
コード例 #4
0
 public bool DeleteAdvert(int id, string userId)
 {
     return(_advertRepository.DeleteAdvert(id, userId));
 }