The error is: Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments
I have no idea why this is happening, please bare in mind that I'm very new to C# and don't exactly understand how to work with it yet. I'm trying to get the file to retrieve a column from a database table and insert it into a CSV file with extra headers. The database table is cmsDictionary and the column is key, this should populate the CSV key column and the others should be blank to be populated by the user which will then be imported into the cmsLanguageText table.
//This is my controller file which is throwing the error.
using UmbracoImportExportPlugin.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Text;
using Umbraco.Core.Persistence;
using Umbraco.Web;
using Umbraco.Web.WebApi;
using System.Data;
using System.Data.SqlClient;
namespace UmbracoImportExportPlugin.App_Code
{
public class ExportDictionaryAllController : UmbracoAuthorizedApiController
{
[System.Web.Http.AcceptVerbs("GET", "POST")]
public static void ExportAll(List<Item> DictionaryItems)
{
getList(List<Item> DictionaryItems);
string attachment = "attachment; filename= DictionaryItems.csv";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("Content-Disposition", attachment);
HttpContext.Current.Response.ContentType = "text/csv";
HttpContext.Current.Response.AddHeader("Pragma", "public");
WriteColumnName();
foreach (Item item in DictionaryItems)
{
WriteItemInfo(item);
}
HttpContext.Current.Response.End();
}
private static void WriteItemInfo(Item item)
{
StringBuilder sb = new StringBuilder();
AddComma(item.Key, sb);
AddComma(item.English, sb);
AddComma(item.Hebrew, sb);
AddComma(item.Russian, sb);
HttpContext.Current.Response.Write(sb.ToString());
HttpContext.Current.Response.Write(Environment.NewLine);
}
private static void AddComma(string value, StringBuilder sb)
{
sb.Append(value.Replace(',', ' '));
sb.Append(", ");
}
private static void WriteColumnName()
{
string columnNames = "Key, English, Hebrew, Russian";
HttpContext.Current.Response.Write(columnNames);
HttpContext.Current.Response.Write(Environment.NewLine);
}
public List<String> getList(List<Item> DictionaryItems)
{
UmbracoDatabase db = ApplicationContext.DatabaseContext.Database;
var select = new Sql("SELECT key FROM cmsDictionary");
List<Item> DictionaryItems = db.Fetch<Item>(select);
return DictionaryItems;
}
}
}