public IActionResult Delete(int id)
        {
            Destination deleteDest = _destinationRepo.Get(id, User.Identity.Name);

            _destinationRepo.Delete(id);
            DeleteImage(deleteDest.ImageFile);
            return(RedirectToAction("Index", "Home"));
        }
Beispiel #2
0
        public async Task <ActionResult <Destination> > DeleteDestinationAsync(int id)
        {
            var destination = await _repository.GetByIdAsync(id);

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

            _repository.Delete(destination);

            await _repository.SaveChangesAsync();

            return(Ok(_mapper.Map <DestinationReadDto>(destination)));
        }