I've create a SPROC that saves an object and returns the id of the new object saved. Now, I'd like to return an int not an int?
public int Save(Contact contact)
{
int? id;
context.Save_And_SendBackID(contact.FirstName, contact.LastName, ref id);
//How do I return an int instead of an int?
}
Thanks for helping
return id.Value; // If you are sure "id" will never be null
or
return id ?? 0; // Returns 0 if id is null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With