Example #1
0
        public IActionResult Delete(string imageName)
        {
            try
            {
                _galleryService.DeleteImage(imageName);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception occured during new skill record creation.");
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction(nameof(List)));
        }
Example #2
0
        public ActionResult DeleteImage(string galleryName, string imageName)
        {
            try
            {
                // Remove image
                GalleryService.DeleteImage(galleryName, imageName, User);

                if (Request.IsAjaxRequest())
                {
                    return(new HttpStatusCodeResult((int)HttpStatusCode.OK));
                }
            }
            catch (Exception ex)
            {
                if (Request.IsAjaxRequest())
                {
                    return(new HttpStatusCodeResult((int)HttpStatusCode.InternalServerError, ex.Message));
                }

                ModelState.AddModelError("", ex.Message);
            }

            return(RedirectToAction("Show", new { GalleryName = galleryName }));
        }