private void DeletePoster(string posterIdStr) { var posterId = new Guid(posterIdStr); var myShowPoster = GetPoster(posterId); var myShowPosterId = myShowPoster.MyShowPosterId.ToString(); var photoId = myShowPoster.Poster.Photo.PhotoId.ToString(); var filename = myShowPoster.Poster.Photo.FileName.ToString(); var posterService = new PosterService(Ioc.GetInstance<IPosterRepository>()); var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>()); var myShowPosterService = new MyShowPosterService(Ioc.GetInstance<IMyShowPosterRepository>()); using (IUnitOfWork uow = UnitOfWork.Begin()) { var photo = myShowPoster.Poster.Photo; var poster = myShowPoster.Poster; photoService.Delete(photo); posterService.Delete(poster); myShowPosterService.Delete(myShowPoster); uow.Commit(); } log.WriteLine("Deleted myShowPoster Id: " + myShowPosterId); log.WriteLine("Deleted photo Id: " + photoId + "and filename: " + filename); log.WriteLine("Deleted picture Id: " + posterId); Response.Redirect(LinkBuilder.MyPostersLink(new Guid(hdnShowId.Value))); }
private void DeletePic(string pictureIdStr) { var pictureId = new Guid(pictureIdStr); var myShowArt = GetPicture(pictureId); var myShowArtId = myShowArt.MyShowArtId.ToString(); var photoId = myShowArt.Art.Photo.PhotoId.ToString(); var filename = myShowArt.Art.Photo.FileName.ToString(); var artService = new ArtService(Ioc.GetInstance<IArtRepository>()); var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>()); var myShowArtService = new MyShowArtService(Ioc.GetInstance<IMyShowArtRepository>()); using (IUnitOfWork uow = UnitOfWork.Begin()) { photoService.Delete(myShowArt.Art.Photo); artService.Delete(myShowArt.Art); myShowArtService.Delete(myShowArt); uow.Commit(); } log.WriteLine("Deleted myShowArt Id: " + myShowArtId); log.WriteLine("Deleted photo Id: " + photoId + "and filename: " + filename); log.WriteLine("Deleted picture Id: " + pictureId); Response.Redirect(LinkBuilder.MyPicturesLink(new Guid(hdnShowId.Value))); }