public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PropertyId,AmenitiesId")] PropertyAmenities propertyAmenities)
        {
            ViewBag.NavigatedTO = "Amenities";
            if (id != propertyAmenities.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(propertyAmenities);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropertyAmenitiesExists(propertyAmenities.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropertyId"]  = new SelectList(_context.Properties, "Id", "Name", propertyAmenities.PropertyId);
            ViewData["AmenitiesId"] = new SelectList(_context.Amenities, "Id", "Name", propertyAmenities.AmenitiesId);
            return(View(propertyAmenities));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,PropertyId,AmenitiesId")] PropertyAmenities propertyAmenities)
        {
            ViewBag.NavigatedTO = "Amenities";
            if (ModelState.IsValid)
            {
                _context.Add(propertyAmenities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropertyId"]  = new SelectList(_context.Properties, "Id", "Name", propertyAmenities.PropertyId);
            ViewData["AmenitiesId"] = new SelectList(_context.Amenities, "Id", "Name", propertyAmenities.AmenitiesId);
            return(View(propertyAmenities));
        }