Пример #1
0
        public async Task <IActionResult> Add(int equipmentId)
        {
            ViewBag.Title = "Add To Cart";
            if (ViewData["UserEquipmentViewModel"] != null)
            {
                return(View((ViewModels.UserEquipmentViewModel)ViewData["UserEquipmentViewModel"]));
            }

            _headerDictionary.Clear();
            _headerDictionary.Add("UserId", GetUserId());
            _headerDictionary.Add("equipmentId", equipmentId);
            _equipmentService.AddHeader(_headerDictionary);
            var result = await _equipmentService.GetAsync <List <ViewModels.UserEquipmentViewModel> >("EquipmentListById");

            var item = (result ?? throw new ArgumentException()).Single();

            return(View(item));
        }