public async Task <IActionResult> Create([Bind("ImageTitle,AboutId,Id,ImagePath,Title,SubTitle")] WhyWe whyWe, IFormFile ImagePath)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(ImagePath.FileName);

            if (ModelState.IsValid)
            {
                whyWe.ImagePath = fileName;
                if (_IsAcceptedFormat(ImagePath.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[ImagePath.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await ImagePath.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(whyWe);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AboutId"] = new SelectList(_context.Abouts, "Id", "Id", whyWe.AboutId);
            return(View(whyWe));
        }
        public IActionResult WhyWe()
        {
            ViewBag.Setting = _toursDbContext.Settings.First();
            WhyWe model = _toursDbContext.WhyWe.FirstOrDefault();

            return(View(model));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ImageTitle,AboutId,Id,ImagePath,Title,SubTitle")] WhyWe whyWe)
        {
            if (id != whyWe.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(whyWe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WhyWeExists(whyWe.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AboutId"] = new SelectList(_context.Abouts, "Id", "Id", whyWe.AboutId);
            return(View(whyWe));
        }