public async Task <IActionResult> Edit(int id, [Bind("AmenityPackageId,Name,Cost,AC,OceanView,MountainView,Minibar,PrivateBeach,Hottub,Penthouse,Valet,ContinentalBreakfast,Coffee")] AmenityPackage amenityPackage) { if (id != amenityPackage.AmenityPackageId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.UpdateAmenityPackage(id, amenityPackage); } catch (DbUpdateConcurrencyException) { if (!AmenityPackageExists(amenityPackage.AmenityPackageId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(amenityPackage)); }
public async Task <IActionResult> Create([Bind("AmenityPackageId,Name,Cost,AC,OceanView,MountainView,Minibar,PrivateBeach,Hottub,Penthouse,Valet,ContinentalBreakfast,Coffee")] AmenityPackage amenityPackage) { if (ModelState.IsValid) { await _context.CreateAmenityPackage(amenityPackage); return(RedirectToAction(nameof(Index))); } return(View(amenityPackage)); }
public void UpdateAmenityPackage(int id, AmenityPackage amenityPackage) { _context.Update(amenityPackage); }
public void DeleteAmenityPackage(AmenityPackage amenityPackage) { _context.Remove(amenityPackage); }
public async Task CreateAmenityPackage(AmenityPackage amenityPackage) { _context.Add(amenityPackage); await _context.SaveChangesAsync(); }