Пример #1
0
 public async Task <IHttpActionResult> getCompany()
 {
     try
     {
         return(Ok(uidService.GetCompany((await commonService.GetLoggedDatabase()).Intial_Catalog)));
     }
     catch (Exception ex)
     {
         string str = ex.Message;
         return(null);
     }
 }
Пример #2
0
 public HttpResponseMessage GetUser(HttpRequestMessage request, string userName, string password)
 {
     try
     {
         UserVM user = userService.GetUser(userName, password);
         if (user != null)
         {
             if (userName.Contains("@"))
             {
                 UID_View uidViw = uidViewService.GetCompany(user.CS_InitialCatalog);
                 if (uidViw.IS_ACTIVATED != null && uidViw.IS_ACTIVATED != false)
                 {
                     user.CodeStatus = 200;
                     return(request.CreateResponse(HttpStatusCode.OK, user));
                 }
                 else
                 {
                     user.CodeStatus = 401;
                     return(request.CreateResponse(HttpStatusCode.Unauthorized, user));
                 }
             }
             else
             {
                 if (user.IS_ACTIVATED != null && user.IS_ACTIVATED != false)
                 {
                     user.CodeStatus = 200;
                     return(request.CreateResponse(HttpStatusCode.OK, user));
                 }
                 else
                 {
                     user.CodeStatus = 401;
                     return(request.CreateResponse(HttpStatusCode.Unauthorized, user));
                 }
             }
         }
         else
         {
             return(request.CreateResponse(HttpStatusCode.OK, new UserVM()
             {
                 CodeStatus = 404
             }));
         }
     }
     catch (Exception ex)
     {
         string str = ex.Message;
         return(request.CreateResponse(HttpStatusCode.OK, new UserVM()
         {
             CodeStatus = 404
         }));
     }
 }