public ActionResult Edit()
        {
            Rekrutacja dataBase = repository.Rekrutacjas.FirstOrDefault();

            if (dataBase == null)
            {
                dataBase = new Rekrutacja
                {
                    Tresc = "Wpisz tutaj treść."
                };
                repository.SaveRekrutacja(dataBase);
            }
            ViewBag.fileList = Directory
                               .EnumerateFiles(fileDirectory, "*", SearchOption.AllDirectories)
                               .Select(Path.GetFileName);
            ViewBag.fileDirectory = fileDirectory;
            return(View(dataBase));
        }
        public ActionResult DeleteFile(string file)
        {
            ViewBag.fileList = Directory
                               .EnumerateFiles(fileDirectory, "*", SearchOption.AllDirectories)
                               .Select(Path.GetFileName);
            ViewBag.fileDirectory = fileDirectory;
            var fileName = "";

            fileName = file;
            var fullPath = Path.Combine(fileDirectory, file);

            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
                ViewBag.deleteSuccess = "true";
            }
            Rekrutacja dataBase = repository.Rekrutacjas.FirstOrDefault();

            return(View("Edit", dataBase));
        }
        public async Task <IActionResult> Edit(Rekrutacja modelReturned, List <IFormFile> files)
        {
            Rekrutacja dataBase = repository.Rekrutacjas.FirstOrDefault();

            dataBase.Tresc = HtmlUtility.RemoveInvalidHtmlTags(modelReturned.Tresc);
            repository.SaveRekrutacja(dataBase);
            if (files != null)
            {
                long size     = files.Sum(f => f.Length);
                var  filePath = "";
                foreach (var formFile in files)
                {
                    filePath = Path.Combine(fileDirectory, formFile.FileName);
                    if (formFile.Length > 0)
                    {
                        using (var stream = new FileStream(filePath, FileMode.Create))
                        {
                            await formFile.CopyToAsync(stream);
                        }
                    }
                }
            }
            return(RedirectToAction(nameof(Index)));
        }