Hello,
which method do you prefer to update my newly saved customer with the last autoincremented Id ?
Do you see any disadvantage in one of both methods?
CustomerRepository.cs
public int AddCustomer(Customer customer)
{
//....
return lastID;
}
BillingViewModel.cs
//Method 1
SelectedCustomer.Id = _customerRepo.AddCustomer(SelectedCustomer);
OR
BillingViewModel.cs
//Method 2
_customerRepo.AddCustomer(ref SelectedCustomer);
CustomerRepository.cs
public void AddCustomer(ref Customer customer)
{
//...
customer.Id = lastId;
}