public async Task <IActionResult> GetAllJsonStringEmployees() { var accepttype = Request.Headers["Accept"]; string employeesstr = string.Empty; if (accepttype == "text/csv+d") { var csv = await northwindRepository.GetAllCSVStringEmployeesAsync(); byte[] filebytes = new byte[csv.Length * sizeof(char)]; System.Buffer.BlockCopy(csv.ToCharArray(), 0, filebytes, 0, filebytes.Length); return(File(filebytes, "text/csv", "employee.csv")); } else if (accepttype == @"text/xml" || accepttype == @"application/xml") { employeesstr = await northwindRepository.GetAllXmlStringEmployeesAsync(); if (string.IsNullOrEmpty(employeesstr)) { return(NotFound("No order found")); } XmlDocument xml = new XmlDocument(); xml.LoadXml(employeesstr); XmlElement root = xml.DocumentElement; return(Ok(root).ForceResultAsXml()); } else { employeesstr = await northwindRepository.GetAllJsonStringEmployeesAsync(); var jsstring = "{\"employees\":" + employeesstr + "}"; var jobject = JObject.Parse(jsstring); return(Ok(jobject)); } }