public static bool AddNewEntry(DbDirectoryEntry newEntryToAdd, out AddDirectoryEntryFailReason result) { DbDirectoryEntry possiblyExistingEntry = GetEntryByName(newEntryToAdd.Name); if (possiblyExistingEntry != null) { result = AddDirectoryEntryFailReason.allreadyExistsDuplicateName; return(false); } possiblyExistingEntry = GetUserByTelephone(newEntryToAdd.TelephoneNumber); if (possiblyExistingEntry != null) { result = AddDirectoryEntryFailReason.allreadyExistsDuplicatePhoneNumber; return(false); } var newid = Directory.Max(x => x.Pkid); newEntryToAdd.Pkid = newid; Directory.Add(newEntryToAdd); result = AddDirectoryEntryFailReason.noErrorEntryAdded; return(true); }
public static bool AddNewEntry(DbDirectoryEntry newEntryToAdd, out AddDirectoryEntryFailReason result) { DbDirectoryEntry possiblyExistingEntry = GetEntryByName(newEntryToAdd.Name); if (possiblyExistingEntry != null) { result = AddDirectoryEntryFailReason.allreadyExistsDuplicateName; return false; } possiblyExistingEntry = GetUserByTelephone(newEntryToAdd.TelephoneNumber); if (possiblyExistingEntry != null) { result = AddDirectoryEntryFailReason.allreadyExistsDuplicatePhoneNumber; return false; } var newid = Directory.Max(x => x.Pkid); newEntryToAdd.Pkid = newid; Directory.Add(newEntryToAdd); result = AddDirectoryEntryFailReason.noErrorEntryAdded; return true; }