public async Task <IActionResult> Update(string guestId)
        {
            var guest = await this.guestsService.GetByIdAsync <GuestUpdateViewModel>(guestId);

            if (!await this.IsValidReservation(guest.ReservationId))
            {
                return(this.NotFound());
            }

            var cities    = this.citiesService.GetAll <CityDropDownViewModel>();
            var countries = this.countriesService.GetAll <CountryDropDownViewModel>();
            var genders   = this.gendersService.GetAll <GenderDropDownViewModel>();

            var viewModel = new GuestUpdateInputModel
            {
                Id                    = guestId,
                FirstName             = guest.FirstName,
                LastName              = guest.LastName,
                CityId                = guest.CityId,
                CountryId             = guest.CountryId,
                DateOfExpiry          = guest.DateOfExpiry,
                DateOfIssue           = guest.DateOfIssue,
                DocumentNumber        = guest.DocumentNumber,
                GenderId              = guest.GenderId,
                PhoneNumber           = guest.PhoneNumber,
                UniqueNumberForeigner = guest.UniqueNumberForeigner,
                IdentificationNumber  = guest.IdentificationNumber,
                Cities                = cities,
                Countries             = countries,
                Genders               = genders,
                ReservationId         = guest.ReservationId,
            };

            return(this.View(viewModel));
        }
        public async Task <IActionResult> Update(GuestUpdateInputModel input)
        {
            if (!await this.IsValidReservation(input.ReservationId))
            {
                return(this.NotFound());
            }

            if (!this.ModelState.IsValid ||
                input.IdentificationNumber == null && input.UniqueNumberForeigner == null ||
                input.CityId == null && input.CountryId == null)
            {
                var cities    = this.citiesService.GetAll <CityDropDownViewModel>();
                var countries = this.countriesService.GetAll <CountryDropDownViewModel>();
                var genders   = this.gendersService.GetAll <GenderDropDownViewModel>();

                input.Cities    = cities;
                input.Countries = countries;
                input.Genders   = genders;

                return(this.View(input));
            }

            await this.guestsService.UpdateAsync(
                input.Id,
                input.FirstName,
                input.LastName,
                input.GenderId,
                input.PhoneNumber,
                input.CityId,
                input.CountryId,
                input.IdentificationNumber,
                input.UniqueNumberForeigner,
                input.DocumentNumber,
                input.DateOfExpiry,
                input.DateOfIssue);

            return(this.RedirectToAction("Details", "Reservations", new { Id = input.ReservationId }));
        }