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();
        }
示例#2
0
 partial void Deletehabitacion(habitacion instance);
示例#3
0
 partial void Updatehabitacion(habitacion instance);
示例#4
0
 partial void Inserthabitacion(habitacion instance);
示例#5
0
		private void detach_habitacions(habitacion entity)
		{
			this.SendPropertyChanging();
			entity.tipo1 = null;
		}
示例#6
0
		private void attach_habitacions(habitacion entity)
		{
			this.SendPropertyChanging();
			entity.tipo1 = this;
		}