// GET: Clients/Create public async Task <IActionResult> Create() { var quartiers = await _quartierService.GetAllDistricts(); var quartierViewModel = _mapper.Map <IEnumerable <QuartierViewModel> >(quartiers); ViewData["Num_Quartier"] = new SelectList(quartierViewModel, "Id", "Nom_Quartier"); return(View()); }
public async Task <IActionResult> Create() { var quartiers = await _quartierService.GetAllDistricts(); var quartierViewModel = _mapper.Map <IEnumerable <QuartierViewModel> >(quartiers); ViewData["Num_Quartier"] = new SelectList(quartierViewModel, "Id", "Nom_Quartier"); var pizzas = await _pizzaService.GetAllPizzas(); var pizzaViewModel = _mapper.Map <IEnumerable <PizzaViewModel> >(pizzas); var quantities = new List <int>(); for (var i = 1; i <= 10; i++) { quantities.Add(i); } ViewData["Num_Pizza"] = new SelectList(pizzaViewModel, "Id", "PizzaToDiplay"); ViewData["Qte_Pizza"] = new SelectList(quantities); if (TempData["ligne"] != null && _lignesCommande != null && _lignesCommande.Any()) { var com = new SaveCommandModel(); com.Ligne_Commandes = TempData.Get <IList <SaveCommandLinesModel> >("ligne"); TempData.Keep("ligne"); return(View(com)); } var command = new SaveCommandModel(); command.Client = new SaveClientModel(); return(View(command)); }