public NewDestinationVm GetDestinationForEdit(int id) { var dest = _destRepo.GetDestinationById(id); var destVm = _mapper.Map <NewDestinationVm>(dest); if (destVm != null) { destVm.Countries = GetCountries().ToList(); } return(destVm); }
public async Task <ActionResult <DestinationDto> > GetDestinationById(int id) { try { var result = await _destinationRepository.GetDestinationById(id); var destinationresult = _mapper.Map <DestinationDto>(result); if (result == null) { return(NotFound($"Could not find any destination with id {id}")); } return(Ok(HateoasMainLinksDestinations(destinationresult))); } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } }