public ActionResult Summary(int index)
        {
            MetadataStructureManager msm = new MetadataStructureManager();

            try
            {
                TaskManager = (EasyUploadTaskManager)Session["TaskManager"];

                //set current stepinfo based on index
                if (TaskManager != null)
                {
                    TaskManager.SetCurrent(index);
                    // remove if existing
                    TaskManager.RemoveExecutedStep(TaskManager.Current());
                }

                EasyUploadSummaryModel model = new EasyUploadSummaryModel();
                model.StepInfo = TaskManager.Current();

                if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.FILENAME))
                {
                    model.DatasetTitle = Convert.ToString(TaskManager.Bus[EasyUploadTaskManager.FILENAME]);

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.DESCRIPTIONTITLE))
                    {
                        string tmp = Convert.ToString(TaskManager.Bus[EasyUploadTaskManager.DESCRIPTIONTITLE]);
                        if (!String.IsNullOrWhiteSpace(tmp))
                        {
                            model.DatasetTitle = Convert.ToString(TaskManager.Bus[EasyUploadTaskManager.DESCRIPTIONTITLE]);
                        }
                    }
                }

                if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SCHEMA))
                {
                    long id = Convert.ToInt64(TaskManager.Bus[EasyUploadTaskManager.SCHEMA]);
                    model.MetadataSchemaTitle = msm.Repo.Get(m => m.Id == id).FirstOrDefault().Name;
                    msm.Dispose();
                }

                if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_FORMAT))
                {
                    model.FileFormat = TaskManager.Bus[EasyUploadTaskManager.SHEET_FORMAT].ToString();
                }

                if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_HEADER_AREA))
                {
                    string selectedHeaderAreaJsonArray = TaskManager.Bus[EasyUploadTaskManager.SHEET_HEADER_AREA].ToString();
                    int[]  areaHeaderValues            = JsonConvert.DeserializeObject <int[]>(selectedHeaderAreaJsonArray);

                    if (model.FileFormat.ToLower() == "topdown")
                    {
                        model.NumberOfHeaders = (areaHeaderValues[3]) - (areaHeaderValues[1]) + 1;
                    }

                    if (model.FileFormat.ToLower() == "leftright")
                    {
                        model.NumberOfHeaders = (areaHeaderValues[2]) - (areaHeaderValues[0]) + 1;
                    }
                }

                if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_DATA_AREA))
                {
                    List <string> selectedDataAreaJsonArray = (List <String>)TaskManager.Bus[EasyUploadTaskManager.SHEET_DATA_AREA];
                    List <int[]>  areaDataValuesList        = new List <int[]>();
                    model.NumberOfData = 0;
                    foreach (string jsonArray in selectedDataAreaJsonArray)
                    {
                        areaDataValuesList.Add(JsonConvert.DeserializeObject <int[]>(jsonArray));
                    }
                    foreach (int[] areaDataValues in areaDataValuesList)
                    {
                        if (model.FileFormat.ToLower() == "leftright")
                        {
                            model.NumberOfData += (areaDataValues[3]) - (areaDataValues[1]) + 1;
                        }

                        if (model.FileFormat.ToLower() == "topdown")
                        {
                            model.NumberOfData += (areaDataValues[2]) - (areaDataValues[0]) + 1;
                        }
                    }
                }

                return(PartialView("EasyUploadSummary", model));
            }
            finally
            {
                msm.Dispose();
            }
        }
        public ActionResult Summary(object[] data)
        {
            MetadataStructureManager msm = new MetadataStructureManager();

            try
            {
                TaskManager = (EasyUploadTaskManager)Session["TaskManager"];
                EasyUploadSummaryModel model = new EasyUploadSummaryModel();

                model.StepInfo  = TaskManager.Current();
                model.ErrorList = FinishUpload(TaskManager);

                if (model.ErrorList.Count > 0)
                {
                    #region Populate model with data from the TaskManager

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.FILENAME))
                    {
                        model.DatasetTitle = Convert.ToString(TaskManager.Bus[EasyUploadTaskManager.FILENAME]);
                    }

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SCHEMA))
                    {
                        long id = Convert.ToInt64(TaskManager.Bus[EasyUploadTaskManager.SCHEMA]);
                        model.MetadataSchemaTitle = msm.Repo.Get(m => m.Id == id).FirstOrDefault().Name;
                    }

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_FORMAT))
                    {
                        model.FileFormat = TaskManager.Bus[EasyUploadTaskManager.SHEET_FORMAT].ToString();
                    }

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_HEADER_AREA))
                    {
                        string selectedHeaderAreaJsonArray = TaskManager.Bus[EasyUploadTaskManager.SHEET_HEADER_AREA].ToString();
                        int[]  areaHeaderValues            = JsonConvert.DeserializeObject <int[]>(selectedHeaderAreaJsonArray);

                        if (model.FileFormat.ToLower() == "topdown")
                        {
                            model.NumberOfHeaders = (areaHeaderValues[3]) - (areaHeaderValues[1]) + 1;
                        }

                        if (model.FileFormat.ToLower() == "leftright")
                        {
                            model.NumberOfHeaders = (areaHeaderValues[2]) - (areaHeaderValues[0]) + 1;
                        }
                    }

                    if (TaskManager.Bus.ContainsKey(EasyUploadTaskManager.SHEET_DATA_AREA))
                    {
                        List <string> selectedDataAreaJsonArray = (List <string>)TaskManager.Bus[EasyUploadTaskManager.SHEET_DATA_AREA];
                        List <int[]>  areaDataValuesList        = new List <int[]>();
                        foreach (string area in selectedDataAreaJsonArray)
                        {
                            areaDataValuesList.Add(JsonConvert.DeserializeObject <int[]>(area));
                        }

                        foreach (int[] areaDataValues in areaDataValuesList)
                        {
                            if (model.FileFormat.ToLower() == "leftright")
                            {
                                model.NumberOfData = (areaDataValues[3]) - (areaDataValues[1]) + 1;
                            }

                            if (model.FileFormat.ToLower() == "topdown")
                            {
                                model.NumberOfData = (areaDataValues[2]) - (areaDataValues[0]) + 1;
                            }
                        }
                    }

                    #endregion Populate model with data from the TaskManager

                    return(PartialView("EasyUploadSummary", model));
                }
                else
                {
                    return(null);
                }
            }
            finally
            {
                msm.Dispose();
            }
        }