Hi Team
I have problem, my modal to create is not saving to my database table. Here is my logic;
- [Route("Home/CoursesRegistration")]
- public ActionResult CoursesRegistration(eNtsaRegCourses model) {
- if (ModelState.IsValid) {
- ViewBag.Message = "Course created";
- ModelState.Clear();
- cb.SaveChanges();
- return PartialView("CoursesRegistration", "Home");
- }
- return View("eNtsaCourses", model);
- }
- //GET://Courses/Courses-All.
- [Route("Home/Courses")]
- public ActionResult Courses(eNtsaCourses courses) {
- if (ModelState.IsValid) {
- var data = cb.eNtsaCourse.Add(courses);
- }
- return View(courses);
- }
- // db-schema lists.
- public class eNtsaCourses
- {
- [Key]
- public Guid? Id { get; set; }
- public string Course { get; set; }
- public string Nickname { get; set; }
- public string Term { get; set; }
- public string EnrolledAs { get; set; }
- public bool Published { get; set; }
- }
- class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">class="modal-dialog" role="document">class="modal-content">class="modal-header">
class
="modal-title" id="exampleModalLabel">Start New Course- class="close" data-dismiss="modal" aria-label="Close">
- "true">×
class="form-group row">- ="CourseName" class="col-sm-3 col-form-label">CourseName
class="col-sm-5">- @Html.EditorFor(model => model.CourseName, new { htmlAttributes = new { @class = "form-control", autofocus = "autofocus", placeholder = "CourseName" } })
class="form-group row">- ="Content-Licence" class="col-sm-3 col-form-label">Content Licence
class="col-sm-5">class="modal-footer">- class="btn btn-secondary" data-dismiss="modal">Cancel
- class='modal-link btn-xs btn-success' href="@Url.Action("CoursesRegistration", "Home")">Create Course
9 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Varun SetiaPosted Aug 26, 2020, 5:25 AM
Guest UserPosted Aug 26, 2020, 4:20 AM
Varun SetiaPosted Aug 26, 2020, 4:14 AM
Guest UserPosted Aug 25, 2020, 4:12 AM
Laxmidhar SahooPosted Aug 21, 2020, 3:35 AM
Ashutosh GuptaPosted Aug 21, 2020, 12:15 AM
Guest UserPosted Aug 20, 2020, 6:11 AM
class
="modal-title" id="exampleModalLabel">Start New CourseAsma KhalidPosted Aug 20, 2020, 4:36 AM
Farhan AhmedPosted Aug 19, 2020, 12:29 PM