public IActionResult List()
        {
            DestinationsListViewModel model = new DestinationsListViewModel()
            {
                Destinations = context.Destinations.OrderBy(d => d.DestinationId)
            };

            return(View(model));
        }
        public ActionResult GetDestinations()
        {
            var moreDestinations = this.destinationService.GetDestinations(0, destinationsCount + ControllersConstants.DestinationsBatchIncrease)
                                   .Where(d => d.IsDeleted == false)
                                   .ProjectTo <DestinationItemViewModel>()
                                   .ToList();

            destinationsCount += ControllersConstants.DestinationsBatchIncrease;

            var moreDestinationsModel = new DestinationsListViewModel()
            {
                Destinations = moreDestinations
            };

            return(PartialView("PopularDestinations", moreDestinationsModel));
        }
Example #3
0
        public async Task <IActionResult> Index()
        {
            //TODO move serialization in helper

            DestinationsListViewModel destinations = new DestinationsListViewModel()
            {
            };

            HttpResponseMessage res = await _client.GetAsync("api/HolidayDestinations");

            if (res.IsSuccessStatusCode)
            {
                var result = res.Content.ReadAsStringAsync().Result;
                destinations = JsonConvert.DeserializeObject <DestinationsListViewModel>(result);
            }
            return(View(destinations));
        }
        // GET: /
        public ActionResult Index()
        {
            if (this.destinationService.GetAllDestinations().ToList().Count() > 0)
            {
                var destinations = this.destinationService.GetDestinations(0, ControllersConstants.ItemsPerPage)
                                   .Where(d => d.IsDeleted == false)
                                   .ProjectTo <DestinationItemViewModel>()
                                   .OrderBy(x => x.Country)
                                   .ToList();

                var destinationsModel = new DestinationsListViewModel()
                {
                    Destinations = destinations
                };

                return(this.View(destinationsModel));
            }
            else
            {
                return(this.View());
            }
        }