public ActionResult DeleteConfirmed(int id) { tb_ingresohotel tb_ingresohotel = db.tb_ingresohotel.Find(id); db.tb_ingresohotel.Remove(tb_ingresohotel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "idIngresoHotel,fecviajeini,fecviajefin,feccompraini,feccomprafin,tarifa,codprom,idCadena,idHotel,idTipoHabitacion,montoadulto,montoniño,porcentaje,doble,doblereal,triple,triplereal,cuadruple,cuadruplereal,simple,simplereal,quintuple,quituplereal,sextuple,sextuplereal,child1,child1real,edad1child1,edad2child1,child2,child2real,edad1child2,edad2child2,child3,child3real,edad1child3,edad2child3,infante,infantereal,edadinfante1,edadinfante2,fecharegistro,usuarioregistro,fechamodificacion,usuariomodificacion")] tb_ingresohotel tb_ingresohotel) { if (ModelState.IsValid) { db.Entry(tb_ingresohotel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idCadena = new SelectList(db.tb_cadenahotelera, "idCadenaHotelera", "nombreCadenaHotelera", tb_ingresohotel.idCadena); ViewBag.tarifa = new SelectList(db.tb_categoria, "idCategoria", "nombreCategoria", tb_ingresohotel.tarifa); ViewBag.idHotel = new SelectList(db.tb_hotel, "idHotel", "nombrehotel", tb_ingresohotel.idHotel); return(View(tb_ingresohotel)); }
// GET: IngresosHotel/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_ingresohotel tb_ingresohotel = db.tb_ingresohotel.Find(id); if (tb_ingresohotel == null) { return(HttpNotFound()); } return(View(tb_ingresohotel)); }
public JsonResult EditarIngreso(tb_ingresohotel tb_ingresohotel) { bool status = false; var v = db.tb_ingresohotel.Find(tb_ingresohotel.idIngresoHotel); var isValidModel = TryUpdateModel(tb_ingresohotel); if (isValidModel) { using (db) { db.Entry(v).CurrentValues.SetValues(tb_ingresohotel); db.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status } }); }
// GET: IngresosHotel/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_ingresohotel tb_ingresohotel = db.tb_ingresohotel.Find(id); if (tb_ingresohotel == null) { return(HttpNotFound()); } ViewBag.idCadena = new SelectList(db.tb_cadenahotelera, "idCadenaHotelera", "nombreCadenaHotelera", tb_ingresohotel.idCadena); ViewBag.tarifa = new SelectList(db.tb_categoria.Where(x => x.idTipocategoria == 17), "idCategoria", "nombreCategoria", tb_ingresohotel.tarifa); ViewBag.idHotel = new SelectList(db.tb_hotel, "idHotel", "nombrehotel", tb_ingresohotel.idHotel); ViewBag.idTipoHabitacion = new SelectList(db.tb_tipohabitacion, "idTipoHabitacion", "NombreTipoHabitacion"); ViewBag.serviciohabitacion1 = new SelectList(db.tb_categoria.Where(x => x.idTipocategoria == 29), "idCategoria", "NombreCategoria"); ViewBag.serviciohabitacion2 = new SelectList(db.tb_categoria.Where(x => x.idTipocategoria == 29), "idCategoria", "NombreCategoria"); return(View(tb_ingresohotel)); }
public JsonResult SaveIngresoHotel(tb_ingresohotel ingresohotel) { bool status = false; var isValidModel = TryUpdateModel(ingresohotel); if (isValidModel) { using (db) { ingresohotel.fecharegistro = DateTime.Today; ingresohotel.usuarioregistro = 1; db.tb_ingresohotel.Add(ingresohotel); db.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status } }); }