Update Lesson 2 Task 4
This commit is contained in:
parent
31801ad9ce
commit
62266346ac
1 changed files with 7 additions and 7 deletions
|
@ -26,13 +26,13 @@ do
|
||||||
number = Console.ReadLine();
|
number = Console.ReadLine();
|
||||||
} while (number == null);
|
} while (number == null);
|
||||||
|
|
||||||
var selected = owners.FirstOrDefault(x => cars.Any(y => y.Number == number && y.OwnerID == x.ID));
|
var selected = owners.FirstOrDefault(owner => cars.Any(car => car.Number == number && car.OwnerId == owner.Id));
|
||||||
|
|
||||||
Console.WriteLine(selected);
|
Console.WriteLine(selected);
|
||||||
|
|
||||||
class Owner
|
class Owner
|
||||||
{
|
{
|
||||||
public int ID { get;}
|
public int Id { get;}
|
||||||
public string Name { get;}
|
public string Name { get;}
|
||||||
public string Address { get;}
|
public string Address { get;}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Owner
|
||||||
|
|
||||||
public Owner(int id, string name, string address)
|
public Owner(int id, string name, string address)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
Address = address;
|
Address = address;
|
||||||
}
|
}
|
||||||
|
@ -52,16 +52,16 @@ class Owner
|
||||||
class Car
|
class Car
|
||||||
{
|
{
|
||||||
public string Number { get;}
|
public string Number { get;}
|
||||||
public int OwnerID { get;}
|
public int OwnerId { get;}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "Number: " + Number + ", Owner ID: " + OwnerID;
|
return "Number: " + Number + ", Owner ID: " + OwnerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Car(string number, int ownerid)
|
public Car(string number, int ownerId)
|
||||||
{
|
{
|
||||||
Number = number;
|
Number = number;
|
||||||
OwnerID = ownerid;
|
OwnerId = ownerId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue