Помогите с кодом. Как правильно написать, чтобы можно было редактировать файл?
namespace BizCraft.Areas.Admin.Controllers{ [Area("Admin")] public class TeamController : Controller { private IHostingEnvironment _env { get; } private DataContext _context { get; } public TeamController(DataContext context, IHostingEnvironment env) { _context = context; _env = env; } public IActionResult Index() { return View(_context.Teams); } //Edit public async Task <IActionResult> Edit(int? id) { if (id == null) return NotFound(); Team team = await _context.Teams.FindAsync(id); if (team == null) return NotFound(); return View(team); } [HttpPost] public async Task<IActionResult> Edit(Team team) { _context.Teams.Update(team); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } //Create [HttpGet] public IActionResult Create() { return View(); } [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Create(Team team) { if (!ModelState.IsValid) return View(team); //photo operations if (!team.Photo.IsImage()) { ModelState.AddModelError("Photo", "Image type is not exists"); return View(team); } if (!team.Photo.IsLarger(1)) { ModelState.AddModelError("Photo", "Image size can be larger 1 mg"); return View(team); } team.Image = await team.Photo.SaveFileAsync(_env.WebRootPath, "images/team"); await _context.Teams.AddAsync(team); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } //Delete [HttpGet] public async Task<IActionResult> ConfirmRemove(int? id) { if (id != null) { Team team = await _context.Teams.FirstOrDefaultAsync(t => t.Id == id); return View(team); } return NotFound(); } public IActionResult Remove() { return View(); } [HttpPost] public async Task <IActionResult> Remove(int? id) { if (id != null) { Team team = await _context.Teams.FirstOrDefaultAsync(t => t.Id == id); if (team != null) { IFormFileExtension.Delete(_env.WebRootPath, "images/team", team.Image); _context.Teams.Remove(team); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } } return NotFound(); } }}