public LoginResponseModel Login(LoginRequestModel loginRequestModel) { _nLogLogger.Trace("Start", "Login Controller"); var loginResults = this.loginService.Login(loginRequestModel, this.ActionContext.Request.Headers.Host); _nLogLogger.Trace("After Login Call", "Login Controller"); if (loginResults.Success) { _nLogLogger.Trace("Before Business Rules", "Login Controller"); this.DoBusinessRules(loginResults); _nLogLogger.Trace("After Business Rules", "Login Controller"); var token = GenerateToken.Generate(_nLogLogger); if (token != "") { bool error; var uriBuilder = new UriBuilder(loginResults.RestAccessUrl + "/web/api/sa/SaGetEnv"); var saGetRequest = new SaGetEnvResponse { ttblsaenv = new Ttblsaenv { dateformat = "" } }; var webHeaderCollection = new WebHeaderCollection { { "Token", token }, { "Accept-Encoding", "gzip, deflate" }, { "Accept", "application/json" }, { "Content-Type", "application/json" } }; var responseObject = MakeWebCall.DoWebCallString <SaGetEnvResponse>(uriBuilder.Uri, true, JsonConvert.SerializeObject(saGetRequest), webHeaderCollection, out error, _nLogLogger); if (!error) { loginResults.DateFormat = responseObject.ttblsaenv.dateformat; } else { _nLogLogger.Error("Failed to get environment"); } uriBuilder = new UriBuilder(loginResults.RestAccessUrl + "/web/api/shared/logintimezone"); var tokenObject = GenerateToken.ReturnToken(); var loginZoneTimeRequest = new LoginZoneTimeRequest { ttbllogintimezone = new Ttbllogintimezone { cono = tokenObject.Cono, oper2 = tokenObject.Oper, sessionid = tokenObject.SessionidGuid, logintimezone = loginRequestModel.OffsetTime } }; MakeWebCall.DoWebCallString <string>(uriBuilder.Uri, true, JsonConvert.SerializeObject(loginZoneTimeRequest), webHeaderCollection, out error, _nLogLogger, true); if (error) { _nLogLogger.Error("Failed to set timezone"); } } } return(loginResults); }