Beispiel #1
0
        // Hirdetés törlése
        public async Task <AdvertisementDetailedDTO> DeleteAdvertisement(string userName, int id)
        {
            var advertisement = await AdvertisementRepository.FindByIdAsync(id);

            // Ha helytelen a felhasználónév
            if (advertisement.UserName != userName)
            {
                return(null);
            }

            await AdvertisementRepository.DeleteAsync(advertisement);

            //Képek törlése
            foreach (var image in advertisement.Images)
            {
                ImageRepository.Delete(image.File, advertisement.UserName);
            }
            return(advertisement.ToDetailedDTO());
        }
Beispiel #2
0
 public async Task DeleteAsync(int id)
 {
     await _advertisementRepository.DeleteAsync(id);
 }