Exemple #1
0
 static public iotDomain AppDomainForUserContext(HttpContextBase cont)
 {
     try
     {
         IPrincipal      seesionAuth = cont.User;
         string          username    = seesionAuth.Identity.Name;
         ApplicationUser user        = GetUserWithName(username);
         if (user != null)
         {
             //DeviceRestfulService cl = new DeviceRestfulService();
             iotContext dbcont   = new iotContext();
             string     domainId = DomainSession.GetContextDomain(cont);
             iotDomain  domain   = dbcont.Domains.First(d => d.DomainName.Equals(domainId));//cl.GetDomainWithName(domainId);
             return(domain);
         }
         else
         {
             return(new iotDomain());
         }
     }
     catch (Exception e)
     {
         return(new iotDomain());
     }
 }
Exemple #2
0
 static public iotDomain GetDomainForHttpContext(HttpContextBase hcontext)
 {
     try
     {
         var       cont     = (iotContext)hcontext.Session["iotcontext"];
         string    domainId = DomainSession.GetContextDomain(hcontext);
         iotDomain d        = cont.Domains.First(dm => dm.DomainName.Equals(domainId));
         return(d);
     }
     catch (Exception e)
     {
         throw;
     }
 }