public bool ReqParamUpdate(ActionParameter param)
 {
     try
     {
         iotSharedEntityContext <ActionParameter> propCont = new iotSharedEntityContext <ActionParameter>();
         propCont.UpdateWithHistory(param);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool DeviceTypeUpdate(DeviceType type)
 {
     try
     {
         iotSharedEntityContext <DeviceType> propCont = new iotSharedEntityContext <DeviceType>();
         propCont.UpdateWithHistory(type);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool PropertyUpdate(DeviceProperty Property)
 {
     try
     {
         iotSharedEntityContext <DeviceProperty> propCont = new iotSharedEntityContext <DeviceProperty>();
         propCont.UpdateWithHistory(Property);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool LocationUpdate(Location Location)
 {
     try
     {
         iotSharedEntityContext <Location> propCont = new iotSharedEntityContext <Location>();
         propCont.UpdateWithHistory(Location);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool EndpointUpdate(EndpointInfo endp)
 {
     try
     {
         iotSharedEntityContext <EndpointInfo> propCont = new iotSharedEntityContext <EndpointInfo>();
         propCont.UpdateWithHistory(endp);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool SiteUpdate(Site site)
 {
     try
     {
         iotSharedEntityContext <Site> propCont = new iotSharedEntityContext <Site>();
         propCont.UpdateWithHistory(site);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool DeviceCredentialsUpdate(DeviceCredentials creds)
 {
     try
     {
         iotSharedEntityContext <DeviceCredentials> propCont = new iotSharedEntityContext <DeviceCredentials>();
         propCont.UpdateWithHistory(creds);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool DeviceUpdate(Device device)
 {
     try
     {
         iotSharedEntityContext <Device> propCont = new iotSharedEntityContext <Device>();
         propCont.UpdateWithHistory(device);
         return(true);
         // Task updateTask = Task.Factory.StartNew(() => { DeviceUpdateEventService.SendDeviceUpdate(device); }); //Dispatch update notify
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
        /*********************** Update ***********************/


        public bool DomainUpdate(iotDomain domain)
        {
            try
            {
                iotSharedEntityContext <iotDomain> cont = new iotSharedEntityContext <iotDomain>();
                iotDomain updated = cont.GetById(domain.Id); //db.GetById(domain.DomainName);
                cont.UpdateWithHistory(domain);              //db.UpdateById(domain, domain.DomainName);
                return(true);
            }
            catch (Exception e)
            {
                nlogger.ErrorException(e.Message, e);
                return(false);
            }
        }
 public bool SetDeviceEndpoint(EndpointInfo endp, int DomainId)
 {
     try
     {
         iotSharedEntityContext <EndpointInfo> propCont = new iotSharedEntityContext <EndpointInfo>();
         EndpointInfo stored = propCont.GetById(endp.Id);
         if (stored != null)
         {
             stored = endp;
             propCont.UpdateWithHistory(stored);
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
 public bool SetDeviceCredentials(DeviceCredentials creds)
 {
     try
     {
         iotSharedEntityContext <DeviceCredentials> propCont = new iotSharedEntityContext <DeviceCredentials>();
         DeviceCredentials stored = propCont.GetById(creds.Id);
         if (stored != null)
         {
             stored = creds;
             propCont.UpdateWithHistory(stored);
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }