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

  • SEARCH
  • Home
  • 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 8632017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:17:43+00:00 2026-06-12T09:17:43+00:00

In my action I use a InsertPerson model that has the following properties: pulbic

  • 0

In my action I use a InsertPerson model that has the following properties:

pulbic class InsertPerson
{
     [Required]
     public string Name{get;set;}
}

and I have a DTO model that is passed to my repository:

public class PersonDto
{
     public int Id{get;set;}
     public string Name{get;set;}
     public string LastName{get;set;}
}

my action:

[HttpPost]
public ActionResult Create(InsertPerson insertPerson)
{
     if(ModelState.IsValid){
           var personDto = new PersonDto();

           UpdateModel(personDto)
           //UpdateModel(personDto, "insertPerson") I've tried this too

     }

}

why it doesn’t work(after UpdateModel all properties is still null)?

Is there any way to update my personDto using UpdateModel?

I know about AutoMapper but I think it’s boring to use in controller.


My view:

@model Help_Desk.ViewModel.InsertPersonViewModel

@using (Html.BeginForm())
{
    @Html.TextBoxFor(m => m.InsertPerson.Name)

    <button type="submit">Save</button>
}

and my viewmodel:

public class InsertPersonViewModel
{
    public InsertPerson InsertPerson{ get; set; }
}
  • 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-12T09:17:44+00:00Added an answer on June 12, 2026 at 9:17 am

    Ok, now we see the problem. The information that was missing is that you were using a View Model, and the View Model creates a “container” of sorts that must be accounted for in the UpdateModel.

    What’s happening is that UpdateModel is trying to literally update “InsertPerson.Name” in your personDto object. Since that doesn’t exist, it’s not working.

    You can fix this by specifying UpdateModel(personDto, "InsertPerson")

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

Sidebar

Related Questions

MVC use action attributes to map the same view for http get or post:
In the struts.xml I use: <result name=error>error</result> Then in my action I use: addActionError(ERROR
How do I use the action listeners that are attached to the buttons. And
I am trying to get my head around the use of the Action delegate
C# has built-in delegates Action<> and Func<> . Is it possible to use 'ref'
I have ApiController with Get action like this: public IEnumerable<Note> Get(Guid userId, Guid tagId)
I know that using Action as a method parameter will allow to use lambdas
I have an object like this public class Employee { public String getName() {
I am trying to use action caching to cache an action and then manually
I just started to learn how to use action listeners. To my understanding it

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.