Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:48:15+00:00 2026-06-05T20:48:15+00:00

I have a table in my database like this: [id] [uniqueidentifier] NOT NULL, [user_id]

  • 0

I have a table in my database like this:

[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,

The id is defined to be the primary key.

I want to insert a new record into this table. Here is my code I cannot get to work.

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");
}

The errors I get is on the line dbcd.AddToCustomer_Downloads(collection);

The best overloaded method match for ‘CustomerPortalMVC.Models.CustomerPortalEntities_Customer_Downloads.AddToCustomer_Downloads(CustomerPortalMVC.Models.Customer_Downloads)’
has some invalid arguments

Argument ‘1’: cannot convert from ‘System.Web.Mvc.FormCollection’ to
‘CustomerPortalMVC.Models.Customer_Downloads’

What do I need to change to make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:48:17+00:00Added an answer on June 5, 2026 at 8:48 pm

    You need to provide an object of type CustomerPortalMVC.Models.Customer_Downloads to method AddToCustomer_Downloads and then call SaveChanges on your data context like this:

    public ActionResult Download(string id) 
    { 
        var item = new CustomerPortalMVC.Models.Customer_Downloads(); 
        item.user_id = Membership.GetUser().ProviderUserKey.ToString(); 
        item.download_type = "Car"; 
        item.download_id = id; 
        item.download_date = DateTime.Now.ToString(); 
        item.user_ip_address = Request.ServerVariables["REMOTE_ADDR"];             
        dbcd.AddToCustomer_Downloads(item); 
        dbcd.SaveChanges(); 
        return Redirect("../../Content/files/" + id + ".EXE"); 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that essentially looks like this: id uniqueidentifier NOT NULL data
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have a table in my postgresql 8.4 database like this: id(serial), event_type_id(id, foreign
I always forget how to do things like this. I have a database table
I have a table like this in my database (SQL Server 2008) ID Type
I have written a function to print database table to an array like this
I have a database application in which a group is modeled like this: TABLE
I have a child object in the database that looks like this: CREATE TABLE
I have a database table like this: wagetable name lowhours highhours wage Default 0
I'm using SQL Server 2008. I have a database table that looks like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.