public async Task<IActionResult> EditSubstructureAsync(int? id, Substructure substructure, IFormFile PicturePath)
        {
            var foundSubstructure = db.Substructure.Where(subs => subs.Id == id).FirstOrDefault();
            foundSubstructure.Name = substructure.Name;
            foundSubstructure.Description = substructure.Description;
            foundSubstructure.AddUserID = (int)HttpContext.Session.GetInt32("User_ID");
            foundSubstructure.AdditionDate = DateTime.Now;
            foundSubstructure.Language = substructure.Language;

            // * resim yolu
            if (PicturePath != null)

            {
                string imageExtension = Path.GetExtension(PicturePath.FileName);

                string imageName = Guid.NewGuid() + imageExtension;

                string path = Path.Combine($"wwwroot/img/Substructure/{imageName}");

                using var stream = new FileStream(path, FileMode.Create);

                await PicturePath.CopyToAsync(stream);

                substructure.PicturePath = path;

                substructure.PicturePath = substructure.PicturePath.Substring(substructure.PicturePath.IndexOf("wwwroot")).Replace("wwwroot", string.Empty);

            }


            foundSubstructure.PicturePath = substructure.PicturePath;
            db.Substructure.Update(foundSubstructure);
            db.SaveChanges();
            return RedirectToAction("Substructure");
        }
        public async Task<IActionResult> AddSubstructureAsync(Substructure substructure, IFormFile PicturePath)
        {
            substructure.AddUserID = (int)HttpContext.Session.GetInt32("User_ID");
            substructure.AdditionDate = DateTime.Now;

            // * resim yolu
            if (PicturePath != null)

            {
                string imageExtension = Path.GetExtension(PicturePath.FileName);

                string imageName = Guid.NewGuid() + imageExtension;

                string path = Path.Combine($"wwwroot/img/Substructure/{imageName}");

                using var stream = new FileStream(path, FileMode.Create);

                await PicturePath.CopyToAsync(stream);

                substructure.PicturePath = path;

                substructure.PicturePath = substructure.PicturePath.Substring(substructure.PicturePath.IndexOf("wwwroot")).Replace("wwwroot", string.Empty);

            }


            db.Substructure.Add(substructure);
            db.SaveChanges();
            return RedirectToAction("Substructure");
        }