I have the following method:
//returns -1 on failure
public static int Add(
string name, string email, string password, short defaultNumWeek)
{
KezberPMDBDataContext db = new KezberPMDBDataContext();
Employee employee = new Employee
{
EmployeName = name,
EmployeEmail = email,
EmployePassword = password,
DefaultNumWeek = defaultNumWeek
};
db.Employees.InsertOnSubmit(employee);
try
{
db.SubmitChanges();
}
catch (Exception)
{
return -1;
}
return employee.EmployeID;
}
The last parameter is optional and can be null in the database. How can I do this without creating 2 separate methods? I have other ones that are less simple. How can I pass a base type as null?