コード例 #1
0
        //create new equipment
        public IActionResult Create()
        {
            List <EquipmentType> equipmentTypes = _equipmentTypeSvc.GetAll();

            ViewBag.EquipmentType = new SelectList(equipmentTypes, "Id", "Name");
            return(View());
        }
コード例 #2
0
        private IEnumerable <EquipmentTypeVM> BuildEquipmentTypeSearchQuery(params string[] words)
        {
            IEnumerable <EquipmentTypeDTO> equipmentTypeDTOs = EquipmentTypeService
                                                               .GetAll()
                                                               .ToList()
                                                               .Where(d => words.All(d.Name.ToLower().Contains));

            IEnumerable <EquipmentTypeVM> equipmentTypeVMs = Mapper.Map <IEnumerable <EquipmentTypeVM> >(equipmentTypeDTOs);

            return(equipmentTypeVMs);
        }
コード例 #3
0
        private async void LoadEquipmentTypes()
        {
            var equipmentTypes = (await _equipmentTypeService.GetAll()).ToList();

            equipmentTypes.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));
            AllEquipmentTypes.Clear();

            foreach (var equipmentType in equipmentTypes)
            {
                var amount = await _equipmentItemService.CountByType(equipmentType);

                AllEquipmentTypes.Add(new EquipmentTypeBindableViewModel(equipmentType, amount));
            }
        }
コード例 #4
0
        private async void LoadFreeEquipmentTypes()
        {
            var equipmentTypes = (await _equipmentTypeService.GetAll()).ToList();
            var tempObsCol     = new ObservableCollection <EquipmentTypeBindableViewModel>();

            foreach (var equipmentType in equipmentTypes)
            {
                var amount = await _equipmentItemService.CountFreeByType(equipmentType);

                if (amount > 0)
                {
                    tempObsCol.Add(new EquipmentTypeBindableViewModel(equipmentType, amount));
                }
            }
            FreeEquipmentTypes = tempObsCol;
        }
コード例 #5
0
 public SelectList GetEquipmentTypeIdSelectList(Guid?selectedValue = null)
 {
     return(new SelectList(EquipmentTypeService.GetAll(), "Id", "Name", selectedValue));
 }