public static Customer CreateCustomer(Customer.Type type, string firstname, string lastname, int userId) { if ((firstname == null) || (firstname.Trim() == "")) throw new ArgumentNullException("firstname"); if ((lastname == null) || (lastname.Trim() == "")) throw new ArgumentNullException("lastname"); if (userId <= 0) throw new ArgumentNullException("userId"); Customer newCustomer = new Customer(type, userId); newCustomer.FirstName = firstname.Trim(); newCustomer.LastName = lastname.Trim(); newCustomer.Save(userId); // The user is creating his own record return newCustomer; }
public static void Save(Customer customer, int actionPerformerId) { if (customer == null) throw new ArgumentNullException("customer"); customer.Save(actionPerformerId); }