public ActionResult Index(string ContentTA, HttpPostedFileBase ArticleFU)
        {
            ArticleGradingInfo articleGradingInfo = null;
            bool   fileCantBeGraded = false;
            string text             = null;

            if (ArticleFU != null)
            {
                if (ArticleFU.VerifyArticleType())
                {
                    try
                    {
                        string extension = ArticleFU.FileName.ToLower().Substring(ArticleFU.FileName.LastIndexOf('.') + 1);
                        text = TextGrading.LoadTextFromFile(ArticleFU.InputStream, extension);
                        articleGradingInfo      = TextGrading.AnalyzeSingleText(text);
                        articleGradingInfo.Name = ArticleFU.FileName.Substring(0, ArticleFU.FileName.LastIndexOf('.'));

                        Logger.UpdateNumberOfUses(1);
                    }
                    catch
                    {
                        fileCantBeGraded = true;
                    }
                }
                else
                {
                    fileCantBeGraded = true;
                }
            }
            else
            {
                articleGradingInfo = TextGrading.AnalyzeSingleText(ContentTA);
                Logger.UpdateNumberOfUses(1);
            }


            if (fileCantBeGraded)
            {
                articleGradingInfo       = new ArticleGradingInfo();
                articleGradingInfo.Error = "File can not be graded.";
            }

            return(View(articleGradingInfo));
        }
        private List <ArticleGradingInfo> getArticlesGradingInfoList(IEnumerable <HttpPostedFileBase> i_Articles)
        {
            List <ArticleGradingInfo> articlesGradingInfo = new List <ArticleGradingInfo>();
            string text = null, name;

            if (i_Articles != null)
            {
                foreach (var article in i_Articles)
                {
                    ArticleGradingInfo currentArticleInfo = null;

                    if (article.VerifyArticleType())
                    {
                        try
                        {
                            string extension = article.FileName.ToLower().Substring(article.FileName.LastIndexOf('.') + 1);
                            name = article.FileName.ToLower().Substring(0, article.FileName.LastIndexOf('.'));
                            text = TextGrading.LoadTextFromFile(article.InputStream, extension);

                            currentArticleInfo      = TextGrading.AnalyzeSingleText(text);
                            currentArticleInfo.Name = name + extension;
                        }
                        catch
                        {
                            articlesGradingInfo.Clear();
                            break;
                        }
                    }
                    else
                    {
                        articlesGradingInfo.Clear();
                        break;
                    }

                    if (!string.IsNullOrEmpty(text) && currentArticleInfo.Error == null)
                    {
                        articlesGradingInfo.Add(currentArticleInfo);
                    }
                }
            }

            return(articlesGradingInfo);
        }