public async Task <IActionResult> DeletePhoto(Guid id)
        {
            var photoEntity = await photosRepository.GetPhotoMetaAsync(id);

            if (photoEntity == null)
            {
                return(NotFound());
            }

            if (!await photosRepository.DeletePhotoAsync(photoEntity))
            {
                return(StatusCode(StatusCodes.Status409Conflict));
            }

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <IActionResult> DeletePhoto(Guid id)
        {
            var photoEntity = await photosRepository.GetPhotoMetaAsync(id);

            if (photoEntity == null)
            {
                return(NotFound());
            }

            var result = await photosRepository.DeletePhotoAsync(photoEntity);

            if (!result)
            {
                return(Conflict());
            }
            return(NoContent());
        }