title: picture doesn't appear after edit. MySQL database picture directory as null
body: <p>I am currently on the way of creating a web site using c# .net framework. I can add picture, name, explanation and price. When click on edit and change something the picture that i uploaded doesn't show up. I checked for the problem and realised that after my edit under RESIM column picture name doesn't show up. It writes NULL. I tried to change things in Controller but didn't work.  Also when i delete something picture stay under wwwroot folder.
  My code is here:</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.Rendering;
  using Microsoft.EntityFrameworkCore;
  using ETicaret.Data;
  using Eticaret.Models;
  using Microsoft.AspNetCore.Hosting;
  using System.IO;
  
  namespace Eticaret.Controllers
  {
      public class UrunYonetimi : Controller
      {
          private readonly ETicaretContext _context;
          private readonly IWebHostEnvironment _hostEnvironment;
  
          public UrunYonetimi(ETicaretContext context, IWebHostEnvironment hostEnvironment)
          {
              _context = context;
              _hostEnvironment = hostEnvironment;
          }
  
          // GET: UrunYonetimi
          public async Task&lt;IActionResult&gt; Index()
          {
              return View(await _context.Urunler.ToListAsync());
          }
  
          // GET: UrunYonetimi/Details/5
          public async Task&lt;IActionResult&gt; Details(int? id)
          {
              if (id == null)
              {
                  return NotFound();
              }
  
              var urun = await _context.Urunler
                  .SingleOrDefaultAsync(m =&gt; m.id == id);
              if (urun == null)
              {
                  return NotFound();
              }
  
              return View(urun);
          }
  
          // GET: UrunYonetimi/Create
          public IActionResult Create()
          {
              return View();
          }
  
          // POST: UrunYonetimi/Create
          // To protect from overposting attacks, enable the specific properties you want to bind to.
          // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
          [HttpPost]
          [ValidateAntiForgeryToken]
          public async Task&lt;IActionResult&gt; Create([Bind(&quot;id,Ad,Aciklama,Fiyat,Dosya&quot;)] Urun urun)
          {
              if (ModelState.IsValid)
              {
                  var dosyaYolu =Path.Combine(
                      _hostEnvironment.WebRootPath,
                      &quot;imajlar&quot;);
                  if (Directory.Exists(dosyaYolu))
                  {
                  }
                  else
                  {
                      Directory.CreateDirectory(dosyaYolu);
                  }
  
                  var tamDosyaAdi = Path.Combine(dosyaYolu, urun.Dosya.FileName);
  
                  using (var dosyaAkisi = new FileStream(tamDosyaAdi, FileMode.CreateNew))
                  {
                      await urun.Dosya.CopyToAsync(dosyaAkisi);
                  }
  
                  urun.Resim = urun.Dosya.FileName;
  
                  _context.Add(urun);
                  await _context.SaveChangesAsync();
                  return RedirectToAction(nameof(Index));
              }
              return View(urun);
          }
  
          // GET: UrunYonetimi/Edit/5
          public async Task&lt;IActionResult&gt; Edit(int? id)
          {
              if (id == null)
              {
                  return NotFound();
              }
  
              var urun = await _context.Urunler.FindAsync(id);
              if (urun == null)
              {
                  return NotFound();
              }
              return View(urun);
          }
  
          // POST: UrunYonetimi/Edit/5
          // To protect from overposting attacks, enable the specific properties you want to bind to.
          // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
          [HttpPost]
          [ValidateAntiForgeryToken]
          public async Task&lt;IActionResult&gt; Edit(int id, [Bind(&quot;id,Ad,Aciklama,Fiyat,Dosya&quot;)] Urun urun)
          {
              if (id != urun.id)
              {
                  return NotFound();
              }
  
              if (ModelState.IsValid)
              {
                  try
                  {
                      _context.Update(urun);
                      await _context.SaveChangesAsync();
                  }
                  catch (DbUpdateConcurrencyException)
                  {
                      if (!UrunExists(urun.id))
                      {
                          return NotFound();
                      }
                      else
                      {
                          throw;
                      }
                  }
                  return RedirectToAction(nameof(Index));
              }
              return View(urun);
          }
  
          // GET: UrunYonetimi/Delete/5
          public async Task&lt;IActionResult&gt; Delete(int? id)
          {
              if (id == null)
              {
                  return NotFound();
              }
  
              var urun = await _context.Urunler
                  .FirstOrDefaultAsync(m =&gt; m.id == id);
  
             
  
              if (urun == null)
              {
                  return NotFound();
              }
  
              return View(urun);
          }
  
          // POST: UrunYonetimi/Delete/5
          [HttpPost, ActionName(&quot;Delete&quot;)]
          [ValidateAntiForgeryToken]
          public async Task&lt;IActionResult&gt; DeleteConfirmed(int id)
          {
              var urun = await _context.Urunler.FindAsync(id);
              _context.Urunler.Remove(urun);
  
  
  
              
              await _context.SaveChangesAsync();
              return RedirectToAction(nameof(Index));
          }
  
          private bool UrunExists(int id)
          {
              return _context.Urunler.Any(e =&gt; e.id == id);
          }
      }
  }
  </code></pre>