Exemple #1
0
        public static bool Delete(int id, int type)
        {
            graphic_data target = db.graphic_data.Where(p => p.id == id && p.type == type).FirstOrDefault();

            if (target != null)
            {
                db.graphic_data.Remove(target);
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Exemple #2
0
        public static void Update(GraphicDataWrapper gdw, int type)
        {
            graphic_data target = db.graphic_data.Where(p => p.id == gdw.id && p.type == type).FirstOrDefault();

            if (target != null)
            {
                target.date            = gdw.date;
                target.id_lokasi       = gdw.id_lokasi;
                target.id_parameter    = gdw.id_parameter;
                target.hasil_analisis  = gdw.hasil_analisis;
                target.is_galat        = gdw.is_galat;
                db.Entry(target).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemple #3
0
        public static int Insert(GraphicDataWrapper gdw)
        {
            graphic_data gd = new graphic_data
            {
                id_lokasi      = gdw.id_lokasi,
                id_parameter   = gdw.id_parameter,
                date           = gdw.date,
                hasil_analisis = gdw.hasil_analisis,
                type           = gdw.type,
                is_galat       = gdw.is_galat
            };

            db.graphic_data.Add(gd);
            db.SaveChanges();

            return(gd.id);
        }