0

I am new to ASP.NET if someone could explain why this doesn't work or how to set it up correctly would be great

This code:

    [HttpPost]
    public string Post([FromBody] User account)
    {
        Accounts newAccount = new Accounts { FirstName = account.FirstName, LastName = account.LastName, 
            Email = account.Email, Username = account.Username, Password = account.Password };

        using (AccountsDbEntities entities = new AccountsDbEntities())
        {
            entities.Account.Add(newAccount);
            entities.SaveChanges();
        }

        return "Success";
    }

Is returning this error:

System.ArgumentException: 'The ADO.NET provider with invariant name 'System.Data.SqlClient' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.'

For this line: entities.Account.Add(newAccount);

I am using ASP.NET Core 2.1 with ADO.NET Entity

Is my code wrong or is it configuration?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.