// 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()); }