Posts

Showing posts from December 11, 2018

Access two tables at a time in .net

Image
up vote 0 down vote favorite SELECT TOP 1000 [ID] ,[Name] ,[Phone] ,[Email] ,[AID] ,[Password] ,[Date/time] ,[IsVerify] ,[ProfilePicture] FROM [ChefODine].[dbo].[User] This is my User table AID is the foreign Key of address table having following fields. SELECT TOP 1000 [ID] ,[Location] ,[LAT] ,[Lng] FROM [ChefODine].[dbo].[Address] I want to add user address and other info in database through web service. i want that whenever user add his info the address will save in address table and AID will save in user table. This is my code Please guide me i am new in this. [HttpPost] public User Register([FromBody]User user) { if (db.Users.Any(x => x.Email == user.Email)) throw new Exception("Username "" + user.Email + &qu