public async Task <int> CreateDragonAsync() { string name = CreateDragonName(); int hp = _random.Next(80, 100); DateTime created = DateTime.Now; var dragon = new EFmodels.Dragon { Hp = hp, MaxHp = hp, Created = DateTime.Now, Name = name }; _context.Dragons.Add(dragon); await _context.SaveChangesAsync(); _logger.Debug("Dragon {@dragon} created.", dragon); return(_context.Dragons.FirstOrDefault(d => d.Name == name).Id); }
private bool IsDragonAlive(EFmodels.Dragon dragon) { return(dragon.Hp > 0); }