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
Guest User
Tech Writer
2.1k
473.7k
How to pass reference by object in asp.net mvc?
Sep 9 2020 3:16 AM
Hi Team
I have a method, but i want to pass reference byy object, meaning i have declared it as a string, but when i insert raw data it stored to the db, that is not what i want. I want when a user insert any object name it must store it to the record.
[Route(
"Home/AllCourses"
)]
public
ActionResult CoursesRegistration(RegCoursesViewModel eNtsaRegistration)
{
string courseName =
"TestData"
;
// This stores to the db.
string courseName = string.empty;
// This is not stored to the record
eNtsaRegistration.Courses =
new
eNtsaCourses();
if
(ModelState.IsValid)
{
eNtsaRegistration.Courses.Course = courseName;
eNtsaRegistration.Courses.Id = Guid.NewGuid();
cb.Courses.Add(eNtsaRegistration.Courses);
cb.SaveChanges();
}
return
RedirectToAction(
"AllCourses"
);
}
Reply
Answers (
7
)
How to create div card with buttons in asp.net mvc 5?
How to create routing inside your div card?