示例#1
0
        public ListDestinationForListVm GetAllClients()
        {
            var clients   = _destRepo.GetDestinations().ProjectTo <DestinationForListVm>(_mapper.ConfigurationProvider).ToList();
            var clientsVm = new ListDestinationForListVm()
            {
                Destinations = clients,
                Count        = clients.Count
            };

            return(clientsVm);
        }
示例#2
0
        public ActionResult Destinations()
        {
            var model = new DestinationViewModel();

            var destinations = new List <DestinationViewModel>();

            var tempDestinations = _destinationRepository.GetDestinations().Where(x => x.IsActive).ToList();

            if (tempDestinations != null && tempDestinations.Count > 0)
            {
                foreach (var tempDestination in tempDestinations)
                {
                    DestinationViewModel convertedModel = new DestinationConverter().ConvertToView(tempDestination);

                    destinations.Add(convertedModel);
                }
            }

            model.Destinations = destinations.OrderBy(x => x.DestinationDescription).ToList();

            return(View(model));
        }
        public async Task <ActionResult <Destination[]> > GetDestinations()
        {
            try
            {
                var result = await _destinationRepository.GetDestinations();

                if (result == null)
                {
                    return(NotFound($"Could not find any destinations"));
                }
                return(Ok(result));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}"));
            }
        }
        public async Task <ActionResult <Destination[]> > GetDestinations()
        {
            try
            {
                var result = await _destinationRepository.GetDestinations();

                var destinationresult = _mapper.Map <DestinationDto[]>(result).Select(m => HateoasMainLinksDestinations(m));
                if (result == null)
                {
                    return(NotFound($"Could not find any destinations"));
                }
                return(Ok(destinationresult));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}"));
            }
        }
示例#5
0
 public ActionResult <IEnumerable <Destination> > Get()
 {
     return(_destinationRepository.GetDestinations());
 }