public ActionResult DeletePicture(Guid id)
        {
            var picToDelete = _galleryRepo.GetPictureById(id);

            if (picToDelete == null)
            {
                return(HttpNotFound());
            }

            var result = _galleryRepo.DeletePicture(id, User.Identity.Name, Server);

            if (result == DbRepoStatusCode.NotFound)
            {
                return(HttpNotFound());
            }

            if (result == DbRepoStatusCode.BadRequest)
            {
                return(RedirectToAction("Index", "Home"));
            }

            _fileUploadService.DeleteFile(Server, picToDelete.GalleryId.ToString(), picToDelete.FileName);

            var gallery = _galleryRepo.GetGalleryById(picToDelete.GalleryId);

            var viewModel = new GalleryViewModel
            {
                Gallery              = gallery,
                ContentCategories    = _categoryRepo.GetActiveContentCategories(),
                ContentSubCategories = _categoryRepo.GetContentSubcategoriesByParentId(gallery.ContentCategory.Id)
            };

            return(View($"Edit", viewModel));
        }
Beispiel #2
0
 public bool DeleteEvidenceFile(Guid fileId)
 {
     return(_fileUploadService.DeleteFile(fileId));
 }
Beispiel #3
0
 public virtual IHttpActionResult DeleteFile(long id)
 {
     fileUploadService.DeleteFile(id);
     return(Ok());
 }