Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("TelephoneId,TelephoneModel,TelephoneCout,TelephoneCouleur,ManufacturierId")] Telephone telephone)
        {
            if (id != telephone.TelephoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telephone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelephoneExists(telephone.TelephoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ManufacturierId"] = new SelectList(_context.Manufacturier, "ManufacturierId", "ManufacturierMarque", telephone.ManufacturierId);
            return(View(telephone));
        }
        public async Task <IActionResult> Edit(int id, [Bind("VendeurId,TelephoneId")] TelephoneVendeur telephoneVendeur)
        {
            if (id != telephoneVendeur.TelephoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telephoneVendeur);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelephoneVendeurExists(telephoneVendeur.TelephoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TelephoneId"] = new SelectList(_context.Telephone, "TelephoneId", "TelephoneModel", telephoneVendeur.TelephoneId);
            ViewData["VendeurId"]   = new SelectList(_context.Vendeur, "VendeurId", "VendeurNom", telephoneVendeur.VendeurId);
            return(View(telephoneVendeur));
        }