public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] Hotel hotel) { if (id != hotel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelExists(hotel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotel)); }
//Zapisuje do bazy nowe hotele wraz z pokojami public void UploadHotels(HotelModel hotel) { _context.Update(hotel); _context.SaveChanges(); }