public ActionResult Home() { ReportViewModel reportVM = new ReportViewModel(); try { _logMessage.Append("Getting reports list using sap token Customer Controller Home Method."); ViewBag.IsInternalUser = Identity.IsInternalUser; if (Identity != null && !string.IsNullOrEmpty(Identity.SapToken)) { reportVM.Category = _restClient.GetReportList(Identity.SapToken); _logMessage.Append("Identity and Sap token are present. Sap Token passed is " + Identity.SapToken + "."); } else { _logMessage.Append("Identity or Sap Token is missing"); } if (Identity != null) { //get all tableau views GenericAjaxResponse <List <AHP.Core.DTO.TableauViewInfo> > apiResponse = _restClient.GetUsersViews(Identity.UserName, Identity.IsInternalUser ? "INTERNAL" : "EXTERNAL"); if (apiResponse.Success && apiResponse.Data != null) { List <Web.ViewModel.TableauWorkbookViewModel> uiResponse = apiResponse.Data.Select(dto => new Web.ViewModel.TableauWorkbookViewModel() { Description = dto.Description, ShortDescription = dto.Description.Substring(0, Math.Min(136, dto.Description.Length)), Disabled = dto.Disabled, IsDashboard = dto.IsDashboard, ShortName = dto.ViewName.Substring(0, Math.Min(51, dto.ViewName.Length)), ViewId = dto.ViewId, ViewName = dto.ViewName, ViewUrl = dto.ViewUrl }).ToList(); ViewBag.TableauViews = uiResponse. Where(vw => vw.IsDashboard.Equals("N", StringComparison.OrdinalIgnoreCase) && vw.Disabled.Equals("N", StringComparison.OrdinalIgnoreCase)). ToList(); ViewBag.TableauDashboards = uiResponse.Where(vw => vw.IsDashboard.Equals("Y", StringComparison.OrdinalIgnoreCase) && vw.Disabled.Equals("N", StringComparison.OrdinalIgnoreCase)).ToList(); } } } catch (Exception ex) { _logMessage.Append("An error occurred getting reports. Exception information " + ex.Message); Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex)); } _logger.Info(_logMessage.ToString()); return(View(reportVM)); }