public async Task <IActionResult> Create([Bind("Id,Company_Name,Role_Name,Description,From,To,ImageFile")] Experience_En experience_En)
        {
            if (ModelState.IsValid)
            {
                //save image to wwwroot/Images/MyProjectsEn
                string wwwRootPath = _hostEnvironment.WebRootPath;
                string fileName    = Path.GetFileNameWithoutExtension(experience_En.ImageFile.FileName);
                string extension   = Path.GetExtension(experience_En.ImageFile.FileName);
                fileName = fileName + DateTime.Now.ToString("yymmssff") + extension;
                experience_En.ImageName = fileName;
                string path = Path.Combine(wwwRootPath + "/Images/Experience_En/", fileName);

                using (var fileStream = new FileStream(path, FileMode.Create))
                {
                    await experience_En.ImageFile.CopyToAsync(fileStream);
                }


                //insert record
                _context.Add(experience_En);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(experience_En));
        }
        public async Task <IActionResult> Edit(int?id, Experience_En experience_En, IFormFile file)
        {
            if (id == null)

            {
                return(NotFound());
            }

            Experience_En experience_En2 = await _context.Experience_En.Where(x => x.Id == id).FirstOrDefaultAsync();



            if (experience_En2 == null)

            {
                return(NotFound());
            }

            if (file != null || file.Length != 0)

            {
                string filename = System.Guid.NewGuid().ToString() + ".jpg";

                var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "Images/Experience_En", filename);



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

                {
                    await file.CopyToAsync(stream);
                }



                experience_En2.ImageName = filename;
            }

            experience_En2.Company_Name = experience_En.Company_Name;
            experience_En2.Role_Name    = experience_En.Role_Name;
            experience_En2.Description  = experience_En.Description;
            experience_En2.From         = experience_En.From;
            experience_En2.To           = experience_En.To;



            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Edit(int?id)

        {
            if (id == null)

            {
                return(NotFound());
            }

            Experience_En experience_En2 = await _context.Experience_En.Where(x => x.Id == id).FirstOrDefaultAsync();

            if (experience_En2 == null)

            {
                return(NotFound());
            }



            return(View(experience_En2));
        }