public async Task <IActionResult> Create([Bind("Id,Name,Desc,Image,Snapshot")] Artwork artwork)
        {
            if (ModelState.IsValid)
            {
                artwork.CreatedAt = DateTime.Now;
                if (artwork.Id == 0)
                {
                    _context.Add(artwork);
                }

                else
                {
                    _context.Update(artwork);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artwork));
        }
        public async Task <IActionResult> Create([Bind("ArtworkId,ArtworkName,ArtworkDesc,ArtistName,ArtistIg,Reference,Collection,Price,ArtworkPicture")] Artwork artwork)
        {
            if (ModelState.IsValid)
            {
                string wwwRootPath = _hostEnvironment.WebRootPath;
                string fileName    = Path.GetFileNameWithoutExtension(artwork.ArtworkPicture.FileName);
                string extension   = Path.GetExtension(artwork.ArtworkPicture.FileName);
                artwork.ImageName = fileName = fileName + extension;
                string path = Path.Combine(wwwRootPath + "/Images/Artwork/", fileName);
                using (var fileStream = new FileStream(path, FileMode.Create))
                {
                    await artwork.ArtworkPicture.CopyToAsync(fileStream);
                }


                _context.Add(artwork);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artwork));
        }