public ActionResult Details(string[] areas, string data, string query, string action)
        {
            try
            {
                QueryConfig queries = _reportService.GetQueries();
                ViewBag.Queries = queries.GetQueries();
                var fylker   = _registerService.GetFylker();
                var kommuner = _registerService.GetKommuner();
                ViewBag.fylker   = fylker;
                ViewBag.kommuner = kommuner;
                Dictionary <string, string> codeList = new Dictionary <string, string>();
                codeList = fylker.Union(kommuner).ToDictionary(k => k.Key, v => v.Value);
                ViewBag.selectedAreas = areas;
                ViewBag.data          = data;
                var queryConfig = queries.GetQuery(query, data);
                ViewBag.query = queryConfig;
                ReportQuery reportQuery = new ReportQuery();
                reportQuery.Parameters = new List <ReportQueryParameter>();
                reportQuery.QueryName  = queryConfig.Value;
                foreach (string area in areas)
                {
                    reportQuery.Parameters.Add(new ReportQueryParameter {
                        Name = "area", Value = area
                    });
                }
                reportQuery.Parameters.Add(new ReportQueryParameter {
                    Name = "data", Value = data
                });
                ReportResult result = _reportService.GetQueryResult(reportQuery);

                if (action == "Excel")
                {
                    var fileStream = new ExcelReportGenerator().CreateExcelSheet(reportQuery, result, codeList);

                    var fileStreamResult = new FileStreamResult(fileStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
                    fileStreamResult.FileDownloadName = "Rapport-" + query + ".xlsx";
                    return(fileStreamResult);
                }
                else
                {
                    return(View(result));
                }
            }

            catch (Exception ex)
            {
                Log.Error(ex);
                return(View("Error"));
            }
        }