コード例 #1
0
        public async Task <IActionResult> Edit(int id)
        {
            this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
            var activityToEdit = await this.activitiesService.GetViewModelByIdAsync <ActivityEditViewModel>(id);

            return(this.View(activityToEdit));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id)
        {
            this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
            var restaurantToEdit = await this.restaurantsService.GetViewModelByIdAsync <RestaurantEditViewModel>(id);

            return(this.View(restaurantToEdit));
        }
コード例 #3
0
        public async Task <IActionResult> Search()
        {
            var fromDestination = int.Parse(this.Request.Query["FromDestinationId"]);
            var toDestination   = int.Parse(this.Request.Query["ToDestinationId"]);
            var date            = DateTime.TryParse(this.Request.Query["DateOfDeparture"], out DateTime dateOfDeparture);

            var count = this.tripsService.Count();

            this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);

            TripSearchViewModel searchResultViewModel = await this.destinationsService.GetSearchResultAsync(fromDestination, toDestination, dateOfDeparture);

            return(this.PartialView("_SearchResultPartial", searchResultViewModel));
        }
コード例 #4
0
        public IActionResult Index(int?page)
        {
            var pageNumber = page ?? 1;

            this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
            var trips = this.tripsService.GetTripPosts <TripDetailsViewModel>();

            var viewModel = new TripListViewModel()
            {
                Trips       = trips.ToPagedList(pageNumber, GlobalConstants.ItemsPerPage),
                SearchQuery = new TripSearchInputModel(),
            };

            return(this.View(viewModel));
        }
コード例 #5
0
 public IActionResult Create()
 {
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }
コード例 #6
0
 public async Task <IActionResult> Index(TripSearchInputModel model)
 {
     model.DateOfDeparture         = DateTime.Now;
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }
コード例 #7
0
 public async Task <IActionResult> Index(SearchInputModel searchInputModel)
 {
     this.HttpContext.Session.SetString("SessionsTest", "Test");
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }