示例#1
0
        public async Task <ActionResult <Bond> > PostBond(Bond bond)
        {
            _repository.Insert(bond);
            await _repository.Save();

            return(CreatedAtAction("GetBond", new { id = bond.Id }, bond));
        }
示例#2
0
        private async Task GetBonds()
        {
            try
            {
                // Get list of bonds from Items API
                var bonds = await _bondService.Get();

                if (bonds != null)
                {
                    // Check each bond against the database
                    foreach (var bond in bonds)
                    {
                        // Ensure that bond is not already present and necessary items are stored
                        if (await BondExists(bond.ItemId, bond.CharacterId) ||
                            await _characterRepository.GetCharacter(bond.CharacterId) == null ||
                            await _itemRepository.GetCraftable(bond.ItemId) == null)
                        {
                            continue;
                        }

                        _bondRepository.Insert(bond);
                        await _bondRepository.Save();
                    }
                }
            }
            catch (BrokenCircuitException)
            {
                _logger.LogWarning("Broken Circuit");
            }
        }
示例#3
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var bond = await _repository.Get(id);

            await _repository.Delete(id);

            await _repository.Save();

            return(RedirectToAction(nameof(Index)));
        }