Exemplo n.º 1
0
        public ActionResult Edit(int id, [Bind("CompanyId,Name,Description,StartDate")] Company company)
        {
            if (id != company.CompanyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _companiesRepository.UpdateCompany(company);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_companiesRepository.CompanyExists(company.CompanyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.SelectedNav = "Dashboard";
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.SelectedNav = "Dashboard";
            return(View(company));
        }