Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("FirstName,LastName,Gender,Email,Country,City,Allergies,AmountKids,Side,FriendsOrFamily,Answer,HasPlusOne,NeedTransportation,NeedLodging")] Guest guest)
        {
            var GetGuest = await _guestRepository.Get(id);


            //await _signInManager.SignInAsync(await _context.MarrierUser.FirstOrDefaultAsync(), false);
            var user = await _userService.GetCurrentUser();

            if (id != GetGuest.Id)
            {
                return(NotFound());
            }
            var getcouple = await _context.WeddingCouples
                            .Where(wc => wc.Merriers == user)
                            .FirstOrDefaultAsync();

            var GetWedding = await _weddingRepository.Get(getcouple.Id);

            if (ModelState.IsValid)
            {
                try
                {
                    await _guestRepository.Update(guest);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GuestExists(guest.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(await Index(GetWedding.Id));
            }
            return(await Index(GetWedding.Id));
        }