public ActionResult Create(habitacion se)
        {
            try
            {
                coneccionDataContext bd = new coneccionDataContext();
                se.estado = 1;
                bd.habitacion.InsertOnSubmit(se);

                bd.SubmitChanges();
                estado es = new estado();
                es.descripcion = "activo";
                es.fecha_inicio=DateTime.Now;
                es.motivo =true;
                es.codigo_habitacion = se.codigo_habitacion;
                bd.estado.InsertOnSubmit(es);

                bd.SubmitChanges();
                return Content("true");
            }
            catch
            {
                return Content("false");
            }
        }
 public ActionResult estado(estado a)
 {
     try
     {
         coneccionDataContext bd = new coneccionDataContext();
         estado ac = bd.estado.Where(ss => ss.codigo_estado == a.codigo_estado).First();
         ac.codigo_estado=a.codigo_estado;
         ac.fecha_fin=a.fecha_fin;
         ac.fecha_inicio=a.fecha_inicio;
         ac.descripcion=a.descripcion;
         ac.motivo = a.motivo;
         ac.codigo_habitacion = a.codigo_habitacion;
         bd.SubmitChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 partial void Deleteestado(estado instance);
 partial void Updateestado(estado instance);
 partial void Insertestado(estado instance);
		private void detach_estado1(estado entity)
		{
			this.SendPropertyChanging();
			entity.habitacion = null;
		}
		private void attach_estado1(estado entity)
		{
			this.SendPropertyChanging();
			entity.habitacion = this;
		}