public async Task <IActionResult> Index() { RemoteCall remoteCaller = RemoteCall.GetInstance(); CommWrap <Menu> responseMenu = await remoteCaller.GetMenu(); MenuViewModel menuViewModel = new MenuViewModel(); if (responseMenu.RequestStatus == 1) { Menu menu = responseMenu.Content; menuViewModel.ListSandwiches = menu.Sandwiches.ToList(); menuViewModel.SelectedSandwich = null; menuViewModel.VegetablesPrice = menu.VegetablesPrice; List <VegWithChkBxViewModel> listVegWithChkBxViewModels = new List <VegWithChkBxViewModel>(); foreach (Vegetable veg in menu.Vegetables) { VegWithChkBxViewModel vegWithChkBxViewModel = new VegWithChkBxViewModel { Checked = false, Id = veg.Id, Name = veg.Name, Description = veg.Description }; listVegWithChkBxViewModels.Add(vegWithChkBxViewModel); } menuViewModel.ListVegetablesWithCheckBoxes = listVegWithChkBxViewModels; return(View("Index", menuViewModel)); } AddErrors("Le menu n'a pu ĂȘtre chargĂ© correctement"); return(View("Index", menuViewModel)); /*string id = _userManager.GetUserId(User); * * if (id == null) * { * return NotFound(); * } * * var employee = await _context.Employees * .Include(emp => emp.Orders) * .ThenInclude(order => order.OrderLines) * .ThenInclude(orderLine => orderLine.Sandwich) * .Include(emp => emp.Orders) * .ThenInclude(order => order.OrderLines) * .ThenInclude(orderLine => orderLine.OrderLineVegetables) * .ThenInclude(orderLineVegetable => orderLineVegetable.Vegetable) * .SingleOrDefaultAsync(m => m.Id == id); * */ //string id = _userManager.GetUserId(User); //Employee emp = _context.Employees.Where(e => e.Id == id).FirstOrDefault(); //Order order = GetCurrentOrder(emp); //string serializable = HttpContext.Session.GetString("cart"); //Order order = JsonConvert.DeserializeObject<Order>(serializable); //return View(order.OrderLines.ToList()); }