示例#1
0
        public PartialViewResult PaallaValot()
        {
            MVC_Alytalo_dbEntities entities = new MVC_Alytalo_dbEntities();
            List <Valot>           valot    = (from v in entities.Valot
                                               where v.ValonTila == "1"
                                               select v).ToList();

            entities.Dispose();

            List <SimpleValoData> valotpaalla = new List <SimpleValoData>();

            foreach (Valot valo in valot)
            {
                SimpleValoData data = new SimpleValoData();
                data.Valo_id = valo.Valo_id;
                //data.Huone = Int32.Parse(valo.Huone);
                data.Huone      = valo.Huone;
                data.Valaisin   = valo.Valaisin;
                data.ValonTila  = valo.ValonTila;
                data.ValonMaara = valo.ValonMaara;
                valotpaalla.Add(data);
            }
            return(PartialView("_Valot", valot));
            //return Json(valotpaalla, JsonRequestBehavior.AllowGet);
        }
示例#2
0
        public ActionResult HaeLammot(int?id)
        //public ActionResult HaeValot(string id)
        {
            MVC_Alytalo_dbEntities entities   = new MVC_Alytalo_dbEntities();
            List <Lampotilat>      lampotilat = (from l in entities.Lampotilat
                                                 where l.Huone == id
                                                 select l).ToList();

            entities.Dispose();

            List <SimpleLampotilaData> lammot = new List <SimpleLampotilaData>();

            foreach (Lampotilat lampotila in lampotilat)
            {
                SimpleLampotilaData data = new SimpleLampotilaData();
                data.Lampotila_id = lampotila.Lampotila_id;
                //data.Huone = Int32.Parse(valo.Huone);
                data.Huone            = lampotila.Huone;
                data.NykyLampotila    = lampotila.NykyLampotila;
                data.TavoiteLampotila = lampotila.TavoiteLampotila;
                lammot.Add(data);
            }

            return(Json(lammot, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult HaeValot(int id)
        //public ActionResult HaeValot(string id)
        {
            MVC_Alytalo_dbEntities entities = new MVC_Alytalo_dbEntities();
            List <Valot>           valot    = (from v in entities.Valot
                                               where v.Huone == id
                                               select v).ToList();

            entities.Dispose();

            List <SimpleValoData> tulos = new List <SimpleValoData>();

            foreach (Valot valo in valot)
            {
                SimpleValoData data = new SimpleValoData();
                data.Valo_id = valo.Valo_id;
                //data.Huone = Int32.Parse(valo.Huone);
                data.Huone      = valo.Huone;
                data.Valaisin   = valo.Valaisin;
                data.ValonTila  = valo.ValonTila;
                data.ValonMaara = valo.ValonMaara;
                tulos.Add(data);
            }

            return(Json(tulos, JsonRequestBehavior.AllowGet));
        }
示例#4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
示例#5
0
 public PartialViewResult HaePaallaValot()
 {
     using (MVC_Alytalo_dbEntities entities = new MVC_Alytalo_dbEntities())
     {
         List <Valot> valot = (from v in entities.Valot
                               where v.ValonTila == "1"
                               select v).ToList();
         entities.Dispose();
         return(PartialView("_Valot", valot));
         //return Json(valotpaalla, JsonRequestBehavior.AllowGet);
     }
 }