// GET: Home/Details/5
        public ActionResult Details(int id)
        {
            SampleDBContext db = new SampleDBContext();
            Employee emplooyes = db.Employees.Single(x => x.Id == id);

            //Company company = new Company();

            return View(emplooyes);
        }
        // GET: Home/Details/5
        public ActionResult Details(int id)
        {
            SampleDBContext db = new SampleDBContext();
            Employee emplooye = db.Employees.Single(x => x.Id == id);

            // Strongly type yapmadan view'de modeli kullandırır
            //ViewData["EmployeeData"] = emplooye;

            return View(emplooye);
        }
        public ActionResult Index()
        {
            SampleDBContext db = new SampleDBContext();
            List<SelectListItem> listSelectListItem = new List<SelectListItem>();

            foreach (City city in db.Cities)
            {
                SelectListItem selectListItem = new SelectListItem()
                {
                    Text = city.Name,
                    Value = city.ID.ToString(),
                    Selected = city.IsSelected
                };

                listSelectListItem.Add(selectListItem);
            }
            CitiesViewModel citiesViewModel = new CitiesViewModel();
            citiesViewModel.Cities = listSelectListItem;

            return View(citiesViewModel);
        }
        public ActionResult Edit(Employee employee)
        {
            try
            {
                // TODO: Add update logic here
                if(ModelState.IsValid)
                {
                    SampleDBContext db = new SampleDBContext();
                    Employee employeeFromDB = db.Employees.Single(x => x.Id == employee.Id);

                    employeeFromDB.FullName = employee.FullName;
                    employeeFromDB.Gender = employee.Gender;
                    employeeFromDB.Age = employee.Age;
                    employeeFromDB.HireDate = employee.HireDate;
                    employeeFromDB.Salary = employee.Salary;
                    employeeFromDB.PersonalWebSite = employee.PersonalWebSite;

                    UpdateModel(employeeFromDB);
                    db.SaveChanges();

                    return RedirectToAction("Details", new { id = employee.Id });
                }
                return View(employee);
            }
            catch
            {
                return View();
            }
        }
 // GET: Home/Edit/5
 public ActionResult Edit(int id)
 {
     SampleDBContext db = new SampleDBContext();
     Employee emplooye = db.Employees.Single(x => x.Id == id);
     return View(emplooye);
 }
        public ActionResult Index()
        {
            SampleDBContext db = new SampleDBContext();

            return View(db.Cities);
        }
 // GET: Home
 public ActionResult Index()
 {
     SampleDBContext db = new SampleDBContext();
     return View(db.EmployeePartials.ToList());
 }