Creating Modal for New Person
We will create a Bootstrap Modal to create a new person. First of all, you can create modal and save as you already know and like. But AspNet Zero has some helper scripts to make it easier if you use it. We will use them here.
We can copy cshtml and js files from Areas/App/Views/Common/Modals/Empty folder as a base for a new modal to Areas/App/Views/PhoneBook/_CreatePersonModal.cshtml.
Copied and modified the view code as shown below (_CreatePersonModal.cshtml):
Modal header and footer code comes from the template. We just changed inside of modal-body.
We have a form with three input (name, surname and email address). We're using Person entity's const values in view to set same maxlength to input controls.
Also, copied the _Empty.js from view-resources/Areas/App/Views/Common/Modals/Empty to view-resources/Areas/App/Views/PhoneBook and modified as shown below (_CreatePersonModal.js):
Just named the modal as 'CreatePersonModal'. We will fill the JavaScript code later.