// GET: Company/Edit/5 public ActionResult Edit(int id) { Companies companies = companyRepository.GetCompaniesById(id); if (companies == null) { return(HttpNotFound()); } ViewBag.CountryId = new SelectList(db.Country, "CountryId", "Name"); return(View(companies)); }