How to save checked item of CheckBox List into database in ASP.NET CORE || part-1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone today I'm going to show you how to save item of checked from check box list or you can say that how to save checkbox is checked item of check book list into database table so I have a demo I want to show you so first of all fill the course I have to entity that is the course and the students and in between we have multiple many to many relationships so the title is v-tach that is the core since inserted and now we go for the course and the students there are the course is mentioned when we create a new student there is that is the view model so BCM C and B Tech is there so I want to in wid have the multiple list of the chat box without jquery i al sold it last name first name and the jacob at the rate of gmail.com and that roll number is there okay when we click on the create button the list is there the name is there and into the student table okay No select the database there is not found so click on the SQL server and connect to that database put the name into the database table so give the name to the sequel server and choose your database that is web application 5 ok and test your connection after that you can check your course table student course and the students in which we have three courses student two entries and there are the two student ok that's fine now how to create it so first of all create a course table ok and then get the data from the course from the database table ok so it's easy now create a new controller that is course controller and we have a model ID first name last name in the end the students student course that is the middle layer and the course is the last table so in which we have many to one one relationship and one to many relationship is there in between so both the student and the course we have many to many relationships okay so in the application dbcontext add 3 table that is students course and the student course also you can define the Heskey in which we have student ID and the course ID that is enrolled in the student course table it's not a primary key actually it's a unique you can say in which you can define a new controler ok the course controller in the course controller first of all add a application dbcontext ok and after that your controller is there go p8 a constructor and retrieve the item on the index I want to create a list of the course so get that item course item from the list from the database table and pass to the view so add a new view on the index table with the course model template sorry with the list of template and the course model and the data context is the application to begin test ok add it after that after adding successfully your view you have course view inside your view section that is the index and is that that view is automatically created by the scaffolding so no need to change anything okay there is the index okay the list of item is there in the item in the Moodle okay and when you click on the create button you want to insert any items so create get method of the period is there so now add a new view on the create section and in the create section we have these entry so there is no changes right click on it add view and here you can select create a scaffolding modern classes also course ok and the application DB context is there add click on the Add button after that you can see your these scaffolding okay so here also you not you not need to change anything okay when we click on the submit button the post method will call okay now you can run this application again and see one by one when how to save your course data into the course table so this is the simple click on the course so first of all call the index action method they have the list of items is their V cm C and B tag so soul the resolve them first of all open controller section because the first request getting from the control controller section index method is called and there is the list get the item from the list there is context dot cost or to list when we click on the create button there is the in the view section of your index method click and see your one-hour text box with the submit button so create section all our view that is the create dot CSS tml and we have submit button when we click on the submit button that your submit button is there in the create section call your submit method post matter thank you very much for watching this and please see my second part of this video thank you very much
Info
Channel: ASP.NET MVC
Views: 21,688
Rating: undefined out of 5
Keywords: checkbox list in asp.net core, checked item of checkbox list, asp.net core, part-1, #1, checked items save into database table, many to many relationship, many to many relationship in entityframework core
Id: -7l8VZ92QQ4
Channel Id: undefined
Length: 8min 0sec (480 seconds)
Published: Thu Jan 18 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.