Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CategorieId,Nom,Visible")] CategorieArticle categorieArticle)
        {
            if (id != categorieArticle.CategorieId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categorieArticle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorieArticleExists(categorieArticle.CategorieId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorieArticle));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("CategorieId,Nom,Visible")] CategorieArticle categorieArticle)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categorieArticle);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorieArticle));
        }
Ejemplo n.º 3
0
        private void dtCatArt_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (dtCatArt.SelectedRows.Count > 0)
                {
                    cat = null;
                    btnModifyCat.Enabled = true;
                    btnDeleteCat.Enabled = true;

                    cat = (CategorieArticle)dtCatArt.SelectedRows[0].DataBoundItem;
                    txtIdCatArt.Text     = cat.Id.ToString();
                    txtDesignCatArt.Text = cat.Designation;
                }
            }
            catch (Exception) { MessageBox.Show("Erreur dans la zone d'affichage des Catégories", "Erreur d'affichage"); }
        }