public Hero(IHeroRepository repository, string name) { try { Id = repository.GetAll().LastOrDefault().Id + 1; } catch (ArgumentNullException) { Id = 1; } finally { Name = name; Weapon = CreationServices.GetRandomInt(1, 7); DateOfCreation = DateTime.Now; } }
public Dragon(IDragonRepository repository) { try { Id = repository.GetAll().LastOrDefault().Id + 1; } catch (ArgumentNullException) { Id = 1; } finally { CreatedHealthPoints = CreationServices.GetRandomInt(80, 100); CurrentHealthPoints = CreatedHealthPoints; Name = CreationServices.GetRandomString(CreationServices.GetRandomInt()); DateOfCreation = DateTime.Now; } }