public CharacterEntryModel(SaveFf7Remake save, int index, EquipmentsViewModel weapons, MateriaViewModel materia)
 {
     _save               = save;
     _characterType      = (CharacterType)index;
     _character          = save.Characters[index];
     _characterStats     = save.CharactersStats[index];
     _characterEquipment = save.CharactersEquipment[index];
     Weapons             = weapons;
     Materia             = materia;
 }
示例#2
0
        // GET: Experiments
        public IActionResult Index(string nameequipment, string daterelease, int page = 1, EquipmentsSortState sortOrder = EquipmentsSortState.NameEquipmentAsc)
        {
            int pageSize = 10;
            IQueryable <Equipments> source = _context.Equipments;

            if (nameequipment != null)
            {
                source = source.Where(x => x.NameEquipment == nameequipment);
            }
            if (daterelease != null)
            {
                source = source.Where(x => x.DateRelease == DateTime.Parse(daterelease));
            }

            switch (sortOrder)
            {
            case EquipmentsSortState.NameEquipmentAsc:
                source = source.OrderBy(x => x.NameEquipment);
                break;

            case EquipmentsSortState.NameEquipmentDesc:
                source = source.OrderByDescending(x => x.NameEquipment);
                break;

            case EquipmentsSortState.DateReleaseAsc:
                source = source.OrderBy(x => x.DateRelease);
                break;

            case EquipmentsSortState.DateReleaseDesc:
                source = source.OrderByDescending(x => x.DateRelease);
                break;
            }



            var                 count    = source.Count();
            var                 items    = source.Skip((page - 1) * pageSize).Take(pageSize);
            PageViewModel       pageView = new PageViewModel(count, page, pageSize);
            EquipmentsViewModel ivm      = new EquipmentsViewModel
            {
                PageViewModel   = pageView,
                SortViewModel   = new SortEquipmentsViewModel(sortOrder),
                FilterViewModel = new FilterEquipmentsViewModel(nameequipment, daterelease),
                Equipments      = items
            };

            return(View(ivm));
        }