Ejemplo n.º 1
0
        public IActionResult Details(int id)
        {
            if (id == 0)
            {
                return(RedirectToAction("Index"));
            }

            var ninja      = _repo.GetOne(id);
            var equipments = _repo.GetEquipmentsFromNinja(ninja);

            return(View(new NinjaDetailsViewModel(ninja, equipments)));
        }
Ejemplo n.º 2
0
        public IActionResult Index(int ninjaId, Category category, bool all)
        {
            var equipments = _repo.GetAll();

            if (!all)
            {
                equipments = equipments.FindAll(e => e.Category == category);
            }

            var ninja = _ninjaRepo.GetOne(ninjaId);

            if (ninja == null)
            {
                return(View(equipments.Select(e => new EquipmentIndexViewModel(e, null))));
            }

            return(View(equipments.Select(e => new EquipmentIndexViewModel(e,
                                                                           new NinjaShopViewModel(ninja, _ninjaRepo.GetEquipmentsFromNinja(ninja).ToList())))));
        }