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 8872505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:14:12+00:00 2026-06-14T18:14:12+00:00

I am working on asp.net mvc webapi with EF code first with existing database.

  • 0

I am working on asp.net mvc webapi with EF code first with existing database. I have a class like,

public class User
{
public bool IsAgree{get; set;}
}

Iam using MySql database, my table looks like.

--------------
|ID  |IsAgree|
--------------
|int  |tinyint|
--------------

and i have a post action like

public HttpReponseMessage PostUser(HttpRequestMessage request,User user)
{
// some code to handle user data..
}

and from my view i am trying to post some data to the action like,

$(document).ready(function () {
            var sendata = {"IsAgree":true};
            $.ajax({
                url: '/api/account',
                type: 'POST',
                data: sendata,
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                cache: false,
                success: function (data) {
                    alert(data.status);
                },
                error: function (xhr) { alert(xhr.status); }
            });
        });

when i put breakpoint at action it shows user as null and i get alert message as 400 i.e. bad request. Is my json data was well for my model? Please guide me.

  • 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-14T18:14:13+00:00Added an answer on June 14, 2026 at 6:14 pm

    Try to send the data in this way :

    data: JSON.stringify({ sendata })

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on asp.net mvc 4 web api with EF code first model.
I'm working on an asp .net mvc 4 application. I have created a database
I've just created asp.net mvc 4 app and added default webapi controller public class
So I am working with ASP.Net MVC + jQuery autocomplete and I have a
I'm working in ASP.NET MVC 1.0 using MvcContrib FluentHtml version 1.0. The following code
background:Me and my coworkers are working on asp.net mvc project ... we have a
I'm working on an ASP.NET MVC task list and I'd like to get fancy
I have a ASP.NET MVC 4 application with Web API. It's working great. But
I am working on asp.net MVC 3 project. I am using EF 4.1 code
I'm working with ASP.NET MVC 2. I have a bunch of partial views that

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.