public async Task <IActionResult> Index(RobotsEditCommand robotsEditCommand) { if (ModelState.IsValid) { await System.IO.File.WriteAllTextAsync(GetRobotsTxtFile().FullName, robotsEditCommand.Content, Encoding.UTF8); return(RedirectToAction(nameof(Index)) .Notify(NotificationType.Success, "Changes in robots.txt saved")); } return(View()); }
public async Task <IActionResult> Index() { RobotsEditCommand robotsEditCommand = new RobotsEditCommand(); FileInfo robotsFile = GetRobotsTxtFile(); if (robotsFile.Exists) { robotsEditCommand.Content = await System.IO.File.ReadAllTextAsync(robotsFile.FullName); } return(View(robotsEditCommand)); }