public override async void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { //make sure the first button is tapped. We only have one, but you never know if (index == 0) { var filePath = ((PicturePreviewCell)cell).FilePath; //validate that the filePath isn't empty if (!string.IsNullOrEmpty(filePath)) { //confirm via UIAlert to delete var isDelete = await Helper.Utility.ShowAlert(_lookupService.GetLocalizedString("Confirm"), _lookupService.GetLocalizedString("DeleteFileMessage"), _lookupService.GetLocalizedString("Delete"), _lookupService.GetLocalizedString("Cancel")); if (isDelete) { //delete the file and reload the table _fileHelper.Delete(filePath); _controller.Files.Remove(filePath); //reload the table data without the file in it _tableView.ReloadData(); } else { cell.HideUtilityButtons(true); } } } }
public IResult Delete(CarImage carImage) { var image = _carImageDal.Get(i => i.Id == carImage.Id); if (image == null) { return(new ErrorResult("Image not found")); } _fileHelper.Delete(image.ImagePath); _carImageDal.Delete(carImage); return(new SuccessResult(Messages.CarImageDeleted)); }
public IResult Delete(CarImage carImage) { var image = _carImageDAL.Get(c => c.Id == carImage.Id); if (image == null) { return(new ErrorResult("Image not found")); } _fileHelper.Delete(image.ImagePath); _carImageDAL.Delete(carImage); return(new SuccessResult("Image was deleted successfully")); }
public IResult Delete(CarImage carImage) { var image = _carImageDal.Get(c => c.Id == carImage.Id); if (image == null) { return(new ErrorResult("Resim bulunamadı.")); } _fileHelper.Delete(image.ImagePath); _carImageDal.Delete(carImage); return(new SuccessResult("Resim silindi.")); }
public ActionResult Delete(string path) { //Debug.WriteLine(path); string moja_sciezka_do_tego_projektu = AppDomain.CurrentDomain.BaseDirectory; string pelna_sciezka_do_moich_plikow = moja_sciezka_do_tego_projektu + "App_Data/Upload/"; string sciezka = pelna_sciezka_do_moich_plikow + path; //Debug.WriteLine(sciezka); zaimplementowany_interfejs.Delete(sciezka); return(RedirectToAction("Index")); }
public IResult Delete(CarImage carImage) { IResult result = BusinessRules.Run(CheckAvaiblePicture(carImage.CarImageId)); if (result == null) { var picture = _carImageDal.Get(p => p.CarImageId == carImage.CarImageId); var fileResult = _fileHelper.Delete(picture.ImagePath); _carImageDal.Delete(carImage); if (fileResult.Success) { return(new SuccessResult(Message.ImageDeleted)); } } return(new ErrorResult(Message.ImageDeletedError)); }
async void OnDeleteButtonClick(object sender, EventArgs args) { bool isDeleteComfirmed = false; Button button = (Button)sender; Task <bool> comfirmDelete = DisplayAlert("Are you sure to delete the select item", "", "yes", "no"); isDeleteComfirmed = await comfirmDelete; if (true == isDeleteComfirmed) { string filename = button.StyleId; fileHelper.Delete(filename); RefreshList(); } }
public IActionResult Add(AddMovieViewModel addMovieViewModel) { if (!ModelState.IsValid) { return(View(addMovieViewModel)); } var destinationDir = Path.Combine("img", "posters"); string posterPath; try { posterPath = fileHelper.Save(addMovieViewModel.Poster, destinationDir); } catch { ModelState.AddModelError("", "W czasie zapisywania plakatu na serwerze, wystąpił błąd."); return(View(addMovieViewModel)); } var movie = new Movie { Title = addMovieViewModel.Title, Description = addMovieViewModel.Description, PosterPath = posterPath, ReleaseDate = addMovieViewModel.ReleaseDate.Value, Country = addMovieViewModel.Country }; try { var movieId = movieRepository.AddMovie(movie); return(RedirectToAction(nameof(Details), new { id = movieId })); } catch { fileHelper.Delete(posterPath); ModelState.AddModelError("", "W czasie dodawania filmu do bazy danych, wystąpił błąd."); return(View(addMovieViewModel)); } }
public void Delete(string filename) { fileHelper.Delete(filename); }
public void DeleteConfig(EConfiguration configuration) { FileHelper.Delete(GetFileName(configuration)); }
public void DeleteLog() { _fileHelper.Delete(_loggingPath); this.WriteLine(MessageType.Information, string.Format("Logfile was deleted and recreated on {0}", DateTime.Now)); }