Esempio n. 1
0
 public void Deletar(Quarto quarto)
 {
     using (var contexto = new ReservasModelDb())
     {
         contexto.Entry(quarto).State = System.Data.Entity.EntityState.Deleted;
         contexto.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Alterar(Turista turista)
 {
     using (var contexto = new ReservasModelDb())
     {
         contexto.Entry(turista).State = System.Data.Entity.EntityState.Modified;
         contexto.SaveChanges();
     }
 }
Esempio n. 3
0
 public void Alterar(Hotel hotel)
 {
     using (var db = new ReservasModelDb())
     {
         db.Entry(hotel).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Excluir(int id)
 {
     using (var db = new ReservasModelDb())
     {
         Hotel hotel = new Hotel {
             Id = id
         };
         db.Entry(hotel).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "Id,HotelId,Titulo,Descricao,Quantidade,MaximoOcupantes,ValorDiaria,ValorDiariaCrianca,DiariaPorOcupante")] Quarto quarto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(quarto).State = EntityState.Modified;
         db.SaveChanges();
         // /Quartos/Index/111
         return(RedirectToAction("Index", new { Id = quarto.HotelId }));
     }
     ViewBag.HotelId = new SelectList(db.Hotel, "Id", "Nome", quarto.HotelId);
     return(View(quarto));
 }