title: display the multiple images from database using array
body: <p><strong>Hi Guys I am trying to Display the images from database I save the images in the database but it not display any thing how can i fix this here in my Code</strong></p>
  
  <p><strong>this is my model view</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.ComponentModel.DataAnnotations.Schema;
  using System.Linq;
  using System.Web;
  
  namespace Archive.Models
  {
      public class Inbox
      {
          [Key]
  
          public int Id { get; set; }
  
          public IEnumerable&lt;HttpPostedFileBase&gt; Files { get; set; }
  
  
          public ApplicationUser User { get; set; }
          public object UserId { get; internal set; }
      }
  }
  </code></pre>
  
  <p><strong>and here details</strong> </p>
  
  <pre><code>    namespace Archive.Models
  {
      public class AllFiles
      {
          public int Id { get; set; }
          public string ContentType{ get; set; }
          public byte[] Imagebytes { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>here i Convert</strong> </p>
  
  <pre><code>using System.Web;
  using System.IO;
  
  namespace FileUpload.Service
  {
      public class FileUploadService
      {
          // GET: AllFiles
          public void saveFileDetails(HttpPostedFileBase file)
          {
              AllFiles newfile = new AllFiles();
              newfile.ContentType = file.ContentType;
              newfile.Imagebytes = ConvertToBytes(file);
              ApplicationDbContext db = new ApplicationDbContext();
              {
                  db.AllFiless.Add(newfile);
                  db.SaveChanges();      
              }
          }
          public byte[] ConvertToBytes(HttpPostedFileBase file)
          {
              byte[] imagebytes = null;
              BinaryReader reader = new BinaryReader(file.InputStream);
              imagebytes = reader.ReadBytes((int)file.ContentLength);
              return imagebytes;
          }
      }
  }
  </code></pre>
  
  <p><strong>and here is my Controller</strong></p>
  
  <pre><code>        public async Task&lt;ActionResult&gt; Create(Inbox model)
      {
  
          var currentUser = await manager.FindByIdAsync(User.Identity.GetUserId());
          if (ModelState.IsValid)
          {
              model.User = currentUser;
  
              FileUploadService service = new FileUploadService();
              foreach (var item in model.Files)
              {
                  service.saveFileDetails(item);
              }
  
                  var max = new Inbox();
  
              db.Inboxs.Add(model);
              db.SaveChanges();
              string url = Url.Action("List");
              return Json(new { success = true, url = url });
          }
          return View(model);
      }
  </code></pre>
  
  <p><strong>and this is my view details</strong></p>
  
  <pre><code>    @foreach(var image in Model)
  {
      var base64 = Convert.ToBase64String(image.Files);
      var imgSrc = String.Format("data:{0};base64,{1}",image.ContentType ,base64);
      &lt;img src="@imgSrc"/&gt;
  }
  </code></pre>
  
  <p>i am try to display images here but is not show up what is problem guys please guys i am trying this so hard  i asked here but i did't get the <a href="https://stackoverflow.com/questions/53101963/i-need-just-to-display-the-multiple-images-i-insert/53151836#53151836">images</a></p>
  
  <p><strong>the image in database it saved like this</strong>
  <a href="https://i.stack.imgur.com/Ts9XK.png" rel="nofollow noreferrer">here</a></p>