I am new to c# ,I want to convert a model class object to DataTable in Web API.
Model Class
public class Employee_Master_Model
{
public string UserType { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string MiddleName { get; set; }
public string Mobile { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public bool IsActive { get; set; }
public int EmployeeId { get; set; }
}
Controller:
public async Task<IActionResult> CreateEmployee([FromBody] Employee_Master_Model employee_Master_Model)
{
try
{
// Need to convert the object (employee_Master_Model) to DataTable
}
catch (Exception ex)
{
throw ex;
}
}
trying it for hours can't get it done .Can anyone help me to fix this .