title: how to show all images from server directory in asp.net core
body: <p>I want to show all images (which is in <code>"~/files/ "</code> folder) in asp.net mvc 5. It was like that:</p>
  
  <pre><code>public ActionResult uploadPartial()
  {
       var appData = Server.MapPath("~/files");
       var images = Directory.GetFiles(appData).Select(x =&gt; new imagesviewmodel
       {
          Url = Url.Content("/files/" + Path.GetFileName(x))
       });
       return View(images);
  } 
  </code></pre>
  
  <p>and in view </p>
  
  <pre><code>@model IEnumerable&lt;ckeditortest.Models.imagesviewmodel&gt;
  
  @foreach (var image in Model)
  {
      &lt;a href="#" class="returnImage" data-url="@Request.Url.GetLeftPart(UriPartial.Authority)@image.Url"&gt;
          &lt;img src="@image.Url" alt="Hejsan" id="#image" data-source="@image.Url" width="200" height="200"/&gt;
      &lt;/a&gt;
  }
  </code></pre>
  
  <p>But in asp.net core i don't know how can i do that</p>