Good day to all.. I'm very new to ASP.net programming so pardon my sample code. I have a controller that has this action code. I wanted to put the data from Employee table into a CSV file. Im not good at linq query yet, so i dont know how to get it by row. im using MVC4.
public FileContentResult DownloadCSV()
{
//This is my linq query
var EmployeeQry = from data in db.Employees
select data;
//I want to put my Employee data into a CSV. something like this..
string csv = "EmployeeName,EmployeePostion,EmployeeDepartment";
return File(new System.Text.UTF8Encoding().GetBytes(csv),"text/csv","Report.csv");
}