Exemple #1
0
 public List <gateway> getItems()
 {
     try
     {
         using (var context = new devicesEntities())
         {
             return(context.gateway.ToList <gateway>());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #2
0
 public List <light_meter> getItems()
 {
     try
     {
         using (var context = new devicesEntities())
         {
             return(context.light_meter.ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #3
0
 public bool addItem(light_meter lightMeter)
 {
     try
     {
         using (var context = new devicesEntities())
         {
             if (!existsLightMeter(lightMeter.serial_number))
             {
                 context.light_meter.Add(lightMeter);
                 context.SaveChanges();
                 return(true);
             }
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #4
0
        public bool addItem(gateway gateway)
        {
            try
            {
                using (var context = new devicesEntities())
                {
                    if (!existsGateway(gateway.serial_number))
                    {
                        context.gateway.Add(gateway);
                        context.SaveChanges();
                        return(true);
                    }

                    return(false);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }