public ActionResult registrar(RegHabitacion newhabitacion) { if (ModelState.IsValid) { ConectorDataContext db = new ConectorDataContext(); var t = db.tipos.ToList(); ViewBag.tipo = t; habitacion habi = new habitacion(); // habi.idtipo = newhabitacion.nombre; //ti.nombre = newhabitacion.nombre; //ti.descripcion = newhabitacion.descripcion; //ti.precio = newhabitacion.precio; // db.tipos.InsertOnSubmit(ti); db.SubmitChanges(); int idB = db.tipos.OrderByDescending(a => a.id).First().id; habi.idtipo = idB; habi.estado = newhabitacion.estado; Convert.ToString(newhabitacion.tip); string al = newhabitacion.tip; habi.tipo = al; db.habitacions.InsertOnSubmit(habi); db.SubmitChanges(); return Redirect("../habitaciones/mostrarhabitacion"); } return View(); }
partial void Deletehabitacion(habitacion instance);
partial void Updatehabitacion(habitacion instance);
partial void Inserthabitacion(habitacion instance);
private void detach_habitacions(habitacion entity) { this.SendPropertyChanging(); entity.tipo1 = null; }
private void attach_habitacions(habitacion entity) { this.SendPropertyChanging(); entity.tipo1 = this; }