我的数据库中有一个这样的表:
[id] [uniqueidentifier] NOT NULL,
[user_id] [uniqueidentifier] NOT NULL,
[download_type] [nvarchar](50) NOT NULL,
[download_id] [nvarchar](50) NOT NULL,
[download_date] [datetime] NOT NULL,
[user_ip_address] [nvarchar](20) NOT NULL,
被id
定义为主键。
我想在这个表中插入一条新记录。这是我无法开始工作的代码。
CustomerPortalEntities_Customer_Downloads dbcd = new CustomerPortalEntities_Customer_Downloads();
public ActionResult Download(string id)
{
var collection = new FormCollection();
collection.Add("user_id", Membership.GetUser().ProviderUserKey.ToString());
collection.Add("download_type", "Car");
collection.Add("download_id", id);
collection.Add("download_date", DateTime.Now.ToString());
collection.Add("user_ip_address", Request.ServerVariables["REMOTE_ADDR"]);
dbcd.AddToCustomer_Downloads(collection);
return Redirect("../../Content/files/" + id + ".EXE");
}
我得到的错误是在线 dbcd.AddToCustomer_Downloads(collection);
'CustomerPortalMVC.Models.CustomerPortalEntities_Customer_Downloads.AddToCustomer_Downloads(CustomerPortalMVC.Models.Customer_Downloads)' 的最佳重载方法匹配有一些无效参数
参数“1”:无法从“System.Web.Mvc.FormCollection”转换为“CustomerPortalMVC.Models.Customer_Downloads”
我需要改变什么才能使这项工作?