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)); }
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(); }
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)); }
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)); }
public async Task <IActionResult> Index() { var viewModel = new CategoryViewModel(); this.ViewData["categories"] = SelectListGenerator.GetAllCategories(this.categoryService); return(this.View(viewModel)); }
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)); }
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); }
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)); }
public IActionResult Create() { this.ViewData["Countries"] = SelectListGenerator.GetAllCountries(this.countriesService); return(this.View()); }
public IActionResult Create() { this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService); return(this.View()); }
public async Task <IActionResult> Index(TripSearchInputModel model) { model.DateOfDeparture = DateTime.Now; this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService); return(this.View()); }
public async Task <IActionResult> Index(SearchInputModel searchInputModel) { this.HttpContext.Session.SetString("SessionsTest", "Test"); this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService); return(this.View()); }