Пример #1
0
        public async Task <IActionResult> ViewItem(int id)
        {
            var prod = await _shopManager.GetProductByIdAsync(id, true, true, true);

            if (prod == null)
            {
                return(View("Error", new ErrorViewModel {
                    Message = $"Товар с id {id} не найден."
                }));
            }

            ItemViewModel viewModel = _mapper.Map <ItemViewModel>(prod);

            return(View("ViewItem", viewModel));
        }
Пример #2
0
        public async Task <IActionResult> ViewItem(int id)
        {
            var item = await _shopManager.GetProductByIdAsync(id, true, true, true);

            if (item == null)
            {
                return(NotFound());
            }

            var viewModel = _mapper.Map <ItemViewModel>(item);

            return(View(viewModel));
        }