public void DeleteCarOwner(int id) { if (CarOwners.Any(p => p.ID == id)) { CarOwners.Remove(CarOwners.First(p => p.ID == id)); } fileDataAccess.SetModel(this); }
public CarOwner GetCarOwnerByID(int id) { if (CarOwners.Any(p => p.ID == id)) { return(CarOwners.First(p => p.ID == id)); } return(null); }
public void AddCarOwner(CarOwner carOwner) { if (CarOwners.Any(p => p.ID == carOwner.ID)) { var co = CarOwners.First(p => p.ID == carOwner.ID); co.Name = carOwner.Name; co.Surname = carOwner.Surname; co.SecondName = carOwner.SecondName; co.Phone = carOwner.Phone; co.Birthday = carOwner.Birthday; } else { iCarOwners++; carOwner.ID = iCarOwners; CarOwners.Add(carOwner); } fileDataAccess.SetModel(this); }