public async Task <IActionResult> DeleteBidConfigurationConfirmed(ConfigurationAdminViewModel configVM)
        {
            int id            = configVM.ConfigurationAdminId;
            var configuration = await _context.ConfigurationAdmins.SingleOrDefaultAsync(m => m.ConfigurationAdminId == id);

            _context.ConfigurationAdmins.Remove(configuration);
            await _context.SaveChangesAsync();

            TempData["message"] = $"Bid configuration '{configuration.ConfigurationAdminId}' has been deleted.";
            return(RedirectToAction(nameof(BidConfiguration)));
        }
        public async Task <IActionResult> CreateBidConfiguration([Bind("TauxGlobalComissionAuVendeur,PasGlobalEnchere")]  ConfigurationAdminViewModel configurationVM)
        {
            // validation manuelle:
            string  errMsg = "Please correct the following errors : \n";
            bool    error  = false;
            decimal pasEnchere;
            decimal tauxGlobalComissionAuVendeur;

            if (!decimal.TryParse(configurationVM.PasGlobalEnchere.ToString(), out pasEnchere) || pasEnchere <= 0 || pasEnchere >= 50)
            {
                errMsg += " - The bid step must be a value between 0 and 50 \n";
                error   = true;
            }
            if (!decimal.TryParse(configurationVM.TauxGlobalComissionAuVendeur.ToString(), out tauxGlobalComissionAuVendeur) || tauxGlobalComissionAuVendeur <= 0 || (tauxGlobalComissionAuVendeur) >= 50)
            {
                errMsg += " - The bid commision cost value between 0 and 50 \n";
                error   = true;
            }

            if (error)
            {
                ModelState.AddModelError("CustomValid", errMsg);
                return(View(configurationVM));
            }

            // AUCUNE ERREUR:
            configurationVM.ConfigurationAdminId         = 0;
            configurationVM.PasGlobalEnchere             = pasEnchere;
            configurationVM.TauxGlobalComissionAuVendeur = tauxGlobalComissionAuVendeur / 100m;
            //if (ModelState.IsValid) {

            var configuration = new ConfigurationAdmin {
                ConfigurationAdminId         = 0,
                PasGlobalEnchere             = configurationVM.PasGlobalEnchere,
                TauxGlobalComissionAuVendeur = configurationVM.TauxGlobalComissionAuVendeur
            };

            _context.Add(configuration);
            await _context.SaveChangesAsync();

            TempData["message"] = $"Created sucessfully new configuration # '{configuration.ConfigurationAdminId}'.";
            return(RedirectToAction(nameof(BidConfiguration)));
            //}
        }