Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdRoom,RoomNumber,CheckIn,CheckOut,Description")] Room room)
        {
            if (id != room.IdRoom)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(room);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomExists(room.IdRoom))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdCountry,Name,Details")] Country country)
        {
            if (id != country.IdCountry)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.IdCountry))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Test test)
        {
            if (id != test.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(test);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestExists(test.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(test));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCovid,ProcentageVaccination")] Covid covid)
        {
            if (id != covid.IdCovid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(covid);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CovidExists(covid.IdCovid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCovid"] = new SelectList(_context.Country, "IdCountry", "Name", covid.IdCovid);
            return(View(covid));
        }
Example #5
0
        public async Task <IActionResult> Edit(int id, [Bind("IdWheather,Details")] Weather weather)
        {
            if (id != weather.IdWheather)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(weather);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WeatherExists(weather.IdWheather))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(weather));
        }
Example #6
0
        public async Task <IActionResult> Edit(int id, [Bind("IdHotel,Name,Stars,Description")] Hotel hotel)
        {
            if (id != hotel.IdHotel)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hotel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HotelExists(hotel.IdHotel))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }
Example #7
0
        public async Task <IActionResult> Edit(int id, [Bind("IdUser,Username,Password,ConfirmPassword")] User user)
        {
            if (id != user.IdUser)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.IdUser))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Example #8
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCity,Name")] City city)
        {
            if (id != city.IdCity)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.IdCity))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCity"] = new SelectList(_context.Weather, "IdWheather", "Details", city.IdCity);
            return(View(city));
        }