public ViewResult Edit(int id)
        {
            Employee employee = _empoyleeRepository.GetEmployee(id);
            EmplooysEditViewModel emplooysEditViewModel = new EmplooysEditViewModel
            {
                Id                = employee.Id,
                Name              = employee.Name,
                Email             = employee.Email,
                Department        = employee.Department,
                ExistingPhotoPath = employee.PhotoPath
            };

            return(View(emplooysEditViewModel));
        }
 public IActionResult Edit(EmplooysEditViewModel model)
 {
     if (ModelState.IsValid)
     {
         Employee employee = _empoyleeRepository.GetEmployee(model.Id);
         employee.Name       = model.Name;
         employee.Email      = model.Email;
         employee.Department = model.Department;
         if (model.Photo != null)
         {
             if (model.ExistingPhotoPath != null)
             {
                 string filepath =
                     Path.Combine(hostingEnvironment.WebRootPath, "images", model.ExistingPhotoPath);
                 System.IO.File.Delete(filepath);
             }
             employee.PhotoPath = PrograsUplodFile(model);
         }
         _empoyleeRepository.Update(employee);
         return(RedirectToAction("index"));
     }
     return(View());
 }