Esempio n. 1
0
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////////////////////
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> Create()
        {
            try
            {
                List <EquipmentPropertySpecification> equipmentPropertySpecifications = _context.EquipmentPropertySpecifications
                                                                                        .Where(t => t.IsDeleted == false && t.EquipmentProperty.EquipmentPropertyName == "brand")
                                                                                        .ToList();


                string[] pages = new string[] { "1", "2", "3" };

                List <userData> userData = await RestApiQueries.Users(pages);

                brandOwnerData brandOwnerData = new brandOwnerData()
                {
                    equipmentPropertySpecifications = equipmentPropertySpecifications,
                    userData = userData
                };


                EquipmentPropertyList equipmentPropertyList1 = CreateSelectListItems(brandOwnerData);


                EquipmentPropertyList equipmentPropertyList = new EquipmentPropertyList()
                {
                    brandList = equipmentPropertyList1.brandList,
                    ownerList = equipmentPropertyList1.ownerList
                };
                return(View(equipmentPropertyList));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Esempio n. 2
0
        public EquipmentPropertyList CreateSelectListItems(brandOwnerData brandOwnerData)
        {
            List <SelectListItem> brandListItems = new List <SelectListItem>();
            List <SelectListItem> ownerListItems = new List <SelectListItem>();

            foreach (var item in brandOwnerData.userData)
            {
                SelectListItem selectListItem = new SelectListItem()
                {
                    id    = item.id,
                    label = item.last_name + ", " + item.first_name,
                    code  = item.last_name
                };

                ownerListItems.Add(selectListItem);
            }

            foreach (var item in brandOwnerData.equipmentPropertySpecifications)
            {
                SelectListItem selectListItem = new SelectListItem()
                {
                    id    = item.EquipmentPropertySpecificationId,
                    label = item.EquipmentPropertySpecificationName,
                    code  = item.EquipmentPropertySpecificationName
                };

                brandListItems.Add(selectListItem);
            }

            EquipmentPropertyList equipmentPropertyList = new EquipmentPropertyList()
            {
                brandList = brandListItems,
                ownerList = ownerListItems
            };

            return(equipmentPropertyList);
        }