Ejemplo n.º 1
0
        public async Task <IActionResult> Create(SharedTravelCreateInputViewModel input)
        {
            if (!this.ModelState.IsValid)
            {
                var citiesAsKVP = await this.castCollectionsService.GetCitiesAsKeyValuePairs();

                var typesAsKVP = await this.castCollectionsService.GetTravelTypesAsKeyValuePairs();

                var inputModel = new SharedTravelCreateInputViewModel();
                inputModel.Cities        = citiesAsKVP;
                inputModel.TypesOfTravel = typesAsKVP;

                return(this.View(inputModel));
            }

            var userId    = this.userManager.GetUserId(this.User);
            var createdBy = await this.userManager.FindByIdAsync(userId);

            var advertId = await this.sharedTravelsService.CreateAsync(input, userId);

            var model = new ThankYouVIewModel()
            {
                AdvertId = advertId,
                UserName = createdBy.UserName,
            };

            return(this.View("ThankYou", model));
        }
Ejemplo n.º 2
0
        public IActionResult ThankYou(ThankYouVIewModel model)
        {
            if (model.AdvertId == null || model.UserName == null)
            {
                return(this.NotFound());
            }

            return(this.View(model));
        }