public async Task <IActionResult> Create([Bind("FullName,Upload,Photo,Id,Profession,Description")] HomeTestimonial homeTestimonial)
        {
            if (homeTestimonial.Upload == null)
            {
                ModelState.AddModelError("Upload", "Şəkil məcburidir");
            }
            else
            {
                if (homeTestimonial.Upload.ContentType != "image/jpeg" && homeTestimonial.Upload.ContentType != "image/png" && homeTestimonial.Upload.ContentType != "image/gif")
                {
                    ModelState.AddModelError("Upload", "Siz yalnız png,jpg və ya gif faylı yükləyə bilərsiniz");
                }

                if (homeTestimonial.Upload.Length > 1048576)
                {
                    ModelState.AddModelError("Upload", "Fayl ölcüsu maximum 1MB ola bilər");
                }
            }
            if (ModelState.IsValid)
            {
                var fileName = _fileManager.Upload(homeTestimonial.Upload);
                homeTestimonial.Photo = fileName;

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeTestimonial));
        }
        public async Task <IActionResult> Edit(int id, [Bind("FullName,Upload,Photo,Id,Profession,Description")] HomeTestimonial homeTestimonial)
        {
            if (id != homeTestimonial.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (homeTestimonial.Upload != null)
                    {
                        if (homeTestimonial.Upload.ContentType != "image/jpeg" && homeTestimonial.Upload.ContentType != "image/png" && homeTestimonial.Upload.ContentType != "image/gif")
                        {
                            ModelState.AddModelError("Upload", "Siz yalnız png,jpg və ya gif faylı yükləyə bilərsiniz");
                            return(View(homeTestimonial));
                        }

                        if (homeTestimonial.Upload.Length > 1048576)
                        {
                            ModelState.AddModelError("Upload", "Fayl ölcüsu maximum 1MB ola bilər");
                            return(View(homeTestimonial));
                        }

                        var oldFile = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "uploads", homeTestimonial.Photo);
                        _fileManager.Delete(oldFile);

                        var fileName = _fileManager.Upload(homeTestimonial.Upload, "wwwroot/uploads");
                        homeTestimonial.Photo = fileName;
                    }

                    _context.Update(homeTestimonial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HomeTestimonialExsist(homeTestimonial.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeTestimonial));
        }