public async Task <IActionResult> Edit(int id, [Bind("RentId,BuildingTypeId,UserId,From,To,PricePerDaya,GuestWasHere")] Rent rent)
        {
            if (id != rent.RentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RentExists(rent.RentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "UserId", "UserId", rent.UserId);
            return(View(rent));
        }
        public async Task <IActionResult> Edit(int id, [Bind("BuildingId,Title,City,ZipCode,BedCount,Condition,PricePerDay,HasWlan,WlanPrice,HasParking,ParkingPrice,Space,HasBalkony,UserId,IsActive,ImageId")] Building building)
        {
            if (id != building.BuildingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(building);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuildingExists(building.BuildingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ImageId"] = new SelectList(_context.Set <Image>(), "ImageId", "ImageId", building.ImageId);
            ViewData["UserId"]  = new SelectList(_context.Set <User>(), "UserId", "UserId", building.UserId);
            return(View(building));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ImageId,Name,Description,Content,ContentType")] Image image)
        {
            if (id != image.ImageId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(image);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImageExists(image.ImageId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(image));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Email,Firstname,Lastname,Password")] User user)
        {
            if (id != user.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }