TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tochinicky Onyeamah
NA
43
556
How to post data into a foreign Key table
Aug 7 2018 6:50 AM
Please i need help, i have two tables User and ExistingUser
i have a foreign key UserId in the ExistingUser table,
And on the user interface i can search for the names from the User Table,
how can i post the name into the UserId(FK)column in the ExistingUser table.
i'm using asp.net core 2.0 mvc
[HttpPost]
public
async Task<IActionResult> Existing(BigView big)
{
if
(!ModelState.IsValid)
{
return
View();
}
var student = (from p
in
_context.Users where p.UserId== p.UserId select p).First();
_context.ExistingUser.Add(big.ExistingUser);
await _context.SaveChangesAsync();
return
RedirectToAction(
"Existing"
);
}
Reply
Answers (
2
)
Extract lines between two keywords in Word Document
Ask Question Chat on WEbsite