コード例 #1
0
        public async Task <IActionResult> PutTodoItem(int id, BatteryItems batteryItems)
        {
            if (id != batteryItems.id)
            {
                return(BadRequest());
            }

            _context.Entry(batteryItems).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BatteryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(batteryItems));        // You can create or update data through postman with this put method.
        }
コード例 #2
0
 protected override void AddToList()
 {
     if (ItemType == ItemTypes.Battery)
     {
         BatteryItems.Add(this);
     }
     else
     {
         PowerCellItems.Add(this);
     }
 }
コード例 #3
0
 protected override void AddToList()
 {
     BatteryItems.Add(this);
 }