コード例 #1
0
        // GET: Item/Details/5
        public ActionResult List()
        {
            List <Items>         itemList  = _itemsService.GetAllItems();
            List <ItemViewModel> modelList = new List <ItemViewModel>();

            modelList = _itemHelper.ItemBindModel(itemList);

            return(View(modelList));
        }
コード例 #2
0
        public IActionResult Index()
        {
            var serviceModel = _itemsService.GetAllItems();

            var viewModel = new ItemListViewModel
            {
                Items = serviceModel.Select(i => new ItemDto
                {
                    Id          = i.Id,
                    PicturePath = i.PicturePath,
                    Price       = i.Price,
                    Title       = i.Title
                }).ToList()
            };

            return(View(viewModel));
        }