im using asp.net mvc 5 im new bee here. my problem is i have a tbl_register the content is
Username
password
repeat-password
contact number
then i fill up the form, all i need is to validate if the contact number is existing to another table in tbl_client. this is my code. my code is not working
- var agent = _clientService.Find(x => x.ContactPrimary == newUser.ContactNumber);
-
- if (agent != null)
- {
- var client = new Client
- {
- ParentClientId = agent.FirstOrDefault().Id,
- FirstName = "",
- LastName = "",
- MiddleName = "",
- Suffix = "",
- ContactPrimary = "",
- ContactSecondary = "",
- Age = 0,
- Gender = "",
- CountryId = 0,
- StateId = 0,
- CityId = 0,
- TownId = 0,
- EmailAddress = "",
- Postcode = 0,
- Commission = 0,
- SubAgentCommissionPercentage = 0,
- Address = ""
- };
- _clientService.Add(client);
- }