public HomeController(IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContextAccessor, ImageStoreContext context)
 {
     _environment = hostingEnvironment;
     _context     = context;
     _session     = httpContextAccessor.HttpContext.Session;
     var _player = new PlayerModel();
 }
        public async Task <IActionResult> SaveToDB(IFormFile postedFile)
        {
            TblFile myFile = new TblFile();

            //var basePath = Path.Combine(Directory.GetCurrentDirectory() + "\\Files\\");
            //bool basePathExists = System.IO.Directory.Exists(basePath);
            //if (!basePathExists) Directory.CreateDirectory(basePath);
            var fileName = Path.GetFileNameWithoutExtension(postedFile.FileName);
            //var filePath = Path.Combine(basePath, postedFile.FileName);
            var extension = Path.GetExtension(postedFile.FileName);

            using (var dataStream = new MemoryStream())
            {
                await postedFile.CopyToAsync(dataStream);

                myFile.Data = dataStream.ToArray();
            }
            myFile.ContentType = extension;
            myFile.Name        = fileName;
            ImageStoreContext db = new ImageStoreContext();

            db.TblFiles.Add(myFile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult Display()
        {
            ImageStoreContext db = new ImageStoreContext();

            return(View(db.TblFiles.ToList()));
        }