public ActionResult Edit(CompaniaTelefonoViewModels model)
        {
            if (ModelState.IsValid)
            {
                CompaniaTelefono = dbCtx.CompaniaTelefono.FirstOrDefault(a => a.Id == model.Id);
                CompaniaTelefono.NombreCompania = model.NombreCompania;
                dbCtx.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(int id)
        {
            ViewBag.Title = "Editar Compania";

            CompaniaTelefonoViewModels compania = new CompaniaTelefonoViewModels();

            CompaniaTelefono        = dbCtx.CompaniaTelefono.FirstOrDefault(a => a.Id == id);
            compania.Id             = CompaniaTelefono.Id;
            compania.NombreCompania = CompaniaTelefono.NombreCompania;

            return(View(compania));
        }
 public CompaniaTelefonoController()
 {
     dbCtx            = new ApplicationDbContext();
     CompaniaTelefono = new CompaniaTelefono();
 }