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");
- }

Rohit RaoRank #2,002 · 726 reputationPosted Sep 8, 2020, 11:21 PM EDT
Guest UserRank #877 · 2.5K reputationPosted Sep 9, 2020, 12:00 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 9, 2020, 12:41 AM EDT
Guest UserRank #877 · 2.5K reputationPosted Sep 9, 2020, 12:53 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 9, 2020, 1:23 AM EDT
https://stackoverflow.com/questions/18873098/asp-net-mvc-get-textbox-input-value
Guest UserRank #877 · 2.5K reputationPosted Sep 9, 2020, 1:34 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 9, 2020, 1:39 AM EDT