Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TypeEquippement_FK,Matiere_FK")] TypeEquippementMatiere typeEquippementMatiere)
        {
            if (id != typeEquippementMatiere.Matiere_FK)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeEquippementMatiere);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeEquippementMatiereExists(typeEquippementMatiere.Matiere_FK))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Matiere_FK"]         = new SelectList(_context.Matiere, "Matiere_id", "Matiere_id", typeEquippementMatiere.Matiere_FK);
            ViewData["TypeEquippement_FK"] = new SelectList(_context.TypeEquippement, "Type_Equippement_id", "Type_Equippement_id", typeEquippementMatiere.TypeEquippement_FK);
            return(View(typeEquippementMatiere));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("TypeEquippement_FK,Matiere_FK")] TypeEquippementMatiere typeEquippementMatiere)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeEquippementMatiere);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Matiere_FK"]         = new SelectList(_context.Matiere, "Matiere_id", "Matiere_id", typeEquippementMatiere.Matiere_FK);
            ViewData["TypeEquippement_FK"] = new SelectList(_context.TypeEquippement, "Type_Equippement_id", "Type_Equippement_id", typeEquippementMatiere.TypeEquippement_FK);
            return(View(typeEquippementMatiere));
        }