Exemplo n.º 1
0
        public async Task<IActionResult> Create(CreerSquadViewModel squad)
        {
            if (ModelState.IsValid)
            {
                Squad leSquad = new Squad(squad, CurrentUser.GetUserId());
                // addedSquad.Entity.Id;

                EntityEntry<Squad> addedSquad = _context.Squads.Add(leSquad);
                await _context.SaveChangesAsync();
                return RedirectToAction("Index");
            }
            ViewData["UserId"] = new SelectList(_context.AppUser, "Id", "User", CurrentUser.GetUserId());
            return View(squad);
        }
Exemplo n.º 2
0
        public Squad(CreerSquadViewModel squadTemp, string pUserId)
        {


            foreach (var creerCouleurViewModel in squadTemp.Couleurs)
            {
                Couleurs.Add(new Couleur(creerCouleurViewModel, pUserId));
            }

            UserId = pUserId;
        }