Schleid Alex

Schleid Alex

  • NA
  • 361
  • 47.8k

Create view from view model to show data from two table

Oct 16 2020 8:55 AM
I want to create a "Create view" to enter information for both employee and address from a single page... I have my employemodel and my addressmodel. I am creating an EmployeeViewModel like this
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. namespace gpos.Models  
  6. {  
  7. public class EmployeeViewModel  
  8. {  
  9. public EmployeeModel NewEmployeViewModel { getset; }  
  10. public AddressModel NewAddressViewModel { getset; }  
  11. }  
  12. }  
now in my controller create action I want to generate a view to show data from both employee and address... I know I must use the viewModel but still not clear for me. I would really appreciate some help, tutorial reference...
 
Thank you so much

Answers (5)