コード例 #1
0
        public async Task <IActionResult> Edit(int id)
        {
            this.ViewData["countries"] = SelectListGenerator.GetAllCountries(this.countriesService);
            var destinationToEdit = await this.destinationsService.GetViewModelByIdAsync <DestinationEditViewModel>(id);

            return(this.View(destinationToEdit));
        }
コード例 #2
0
        private void PopulateModel(UserModel userModel, UserEntity user, UserProfileEntity userProfile)
        {
            userModel.Religions      = SelectListGenerator.GetSelectedReligions(userProfile);
            userModel.Statuses       = SelectListGenerator.GetSelectedStatuses(userProfile);
            userModel.Orientations   = SelectListGenerator.GetSelectedOrientations(userProfile);
            userModel.Genders        = SelectListGenerator.GetSelectedGenders(userProfile);
            userModel.Email          = user.UserEmail;
            userModel.UserName       = user.UserUsername;
            userModel.Description    = string.IsNullOrWhiteSpace(userProfile.UserProfileDescription) ? "" : userProfile.UserProfileDescription;
            userModel.Phone          = string.IsNullOrWhiteSpace(userProfile.UserProfilePhone) ? "" : userProfile.UserProfilePhone;
            userModel.Job            = string.IsNullOrWhiteSpace(userProfile.UserProfileJob) ? "" : userProfile.UserProfileJob;
            userModel.Name           = userProfile.UserProfileName;
            userModel.Surname        = userProfile.UserProfileSurname;
            userModel.ReligionId     = userProfile.ReligionId;
            userModel.StatusId       = userProfile.StatusId;
            userModel.OrientationId  = userProfile.OrientationId;
            userModel.GenderId       = userProfile.GenderId;
            userModel.Age            = AgeCalculator.GetDifferenceInYears(userProfile.UserProfileBirthday, DateTime.Now);
            userModel.Birthday       = userProfile.UserProfileBirthday;
            userModel.BirthdayString = DateFormatter.GetDate(userProfile.UserProfileBirthday);
            userModel.Starsign       = StarsignCalculator.GetStarsignName(userProfile.UserProfileBirthday);
            userModel.Motto          = string.IsNullOrWhiteSpace(userProfile.Motto) ? "" : userProfile.Motto;

            var prefHandler = new PreferenceHandler();

            userModel.LikesList    = prefHandler.GetAllForUserProfile(userProfile.UserProfileId, true).Entity.ToList();
            userModel.DislikesList = prefHandler.GetAllForUserProfile(userProfile.UserProfileId, false).Entity.ToList();
        }
コード例 #3
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));
        }
コード例 #4
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));
        }
コード例 #5
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new CategoryViewModel();

            this.ViewData["categories"] = SelectListGenerator.GetAllCategories(this.categoryService);
            return(this.View(viewModel));
        }
コード例 #6
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));
        }
コード例 #7
0
        public RegisterModel GetRegisterModel(RegisterModel registerModel = null)
        {
            if (registerModel == null)
            {
                registerModel = new RegisterModel();
            }

            registerModel.Religions    = SelectListGenerator.GetReligions();
            registerModel.Statuses     = SelectListGenerator.GetStatuses();
            registerModel.Orientations = SelectListGenerator.GetOrientations();
            registerModel.Genders      = SelectListGenerator.GetGenders();

            return(registerModel);
        }
コード例 #8
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));
        }
コード例 #9
0
 public IActionResult Create()
 {
     this.ViewData["Countries"] = SelectListGenerator.GetAllCountries(this.countriesService);
     return(this.View());
 }
コード例 #10
0
 public IActionResult Create()
 {
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }
コード例 #11
0
 public async Task <IActionResult> Index(TripSearchInputModel model)
 {
     model.DateOfDeparture         = DateTime.Now;
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }
コード例 #12
0
 public async Task <IActionResult> Index(SearchInputModel searchInputModel)
 {
     this.HttpContext.Session.SetString("SessionsTest", "Test");
     this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService);
     return(this.View());
 }