コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("EquipmentId,Name")] TypeOfEquipment typeOfEquipment)
        {
            if (id != typeOfEquipment.EquipmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeOfEquipment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeOfEquipmentExists(typeOfEquipment.EquipmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfEquipment));
        }
コード例 #2
0
 public EquipmentDTO(string name, TypeOfEquipment type, string description, int newQuantity, int currentQuantityInMagacine)
 {
     Name        = name;
     Type        = type;
     Description = description;
     NewQuantity = newQuantity;
     CurrentQuantityInMagacine = currentQuantityInMagacine;
 }
コード例 #3
0
 public Equipment(string id, string name, TypeOfEquipment typeOfEquipment, int quantity, string description)
 {
     this.Id          = id;
     this.Name        = name;
     this.Type        = typeOfEquipment;
     this.Quantity    = quantity;
     this.Description = description;
 }
 private void MakeEquipmentAttributes()
 {
     _equipmentName = nameTextBox.Text;
     _newEquipmentQuantity = int.TryParse(quanitityTextBox.Text, out _newEquipmentQuantity) ? _newEquipmentQuantity : 0;
     _equipmentDescription = descriptionTextBox.Text;
     if (typeComboBox.SelectedIndex == 0)
         _equipmentType = TypeOfEquipment.Static;
     else
         _equipmentType = TypeOfEquipment.Dynamic;
 }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("EquipmentId,Name")] TypeOfEquipment typeOfEquipment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeOfEquipment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfEquipment));
        }
        private List <String> getRoomEquipment(TypeOfEquipment typeOfEquipment)
        {
            List <String> equipmentList = new List <String>();

            foreach (DictionaryEntry de in roomEquipment)
            {
                string id = EquipmentController.getInstance().getEquipmentName(de.Key.ToString());
                if (EquipmentController.getInstance().getEquipmentType(de.Key.ToString()).Equals(typeOfEquipment))
                {
                    equipmentList.Add(id + " x" + de.Value.ToString());
                }
            }
            return(equipmentList);
        }
コード例 #7
0
        public Equipment NewEquipment(TypeOfEquipment type, Equipment equipment)
        {
            switch (type)
            {
            case TypeOfEquipment.CONSUMABLE:
            {
                return(new ConsumableEquipmentController().CreateEquipment(equipment));
            }

            case TypeOfEquipment.NON_CONSUMABLE:
            {
                return(new NonConsumableEquipmentController().CreateEquipment(equipment));
            }

            default:
                throw new NotSupportedException();
            }
        }
コード例 #8
0
 public Equipment(long id, TypeOfEquipment tip, int quantity)
 {
     Id       = id;
     type     = tip;
     Quantity = quantity;
 }
コード例 #9
0
 public Equipment(TypeOfEquipment tip, int quantity)
 {
     type     = tip;
     Quantity = quantity;
 }