Exemplo n.º 1
0
        public ActionResult UploadFile()
        {
            //recieving file from form
            HttpPostedFileBase hpf = Request.Files[0] as HttpPostedFileBase;

            //converting file contenttosting
            string FileContent = new StreamReader(hpf.InputStream).ReadToEnd();

            //processingfile content
            FileStats result = new FileStats();

            result          = FileAnalyzer.AnalyzeFile(FileContent);
            result.FileName = Path.GetFileName(hpf.FileName);

            //adding file to db
            fileStatsRepository.InsertFileStats(result);
            fileStatsRepository.Save();

            //displaying results
            return(View("Index", result));
        }