title: ModelBinding Issue with a Struct
body: <p>I have a ViewModel which contains the following struct:</p>
  
  <pre><code>public struct PricesAndDiscounts
  {
      public decimal FlatOff;
      public decimal UnitPrice;
      public decimal TotalDiscount;
      public decimal TotalOptions;
      public decimal TotalOrderPrice;
  }
  </code></pre>
  
  <p>The ViewModel is in a heirarchy such that there is a property of type PricesAndDiscounts which is a member of the DisplayRowPriceViewModel which is a member of the ManageOrderEditModel:<br>
  -ManageOrderEditModel<br>
  --DisplayRowPriceViewModel.  </p>
  
  <p>The "shape" of the request is exactly as I would want and expect (see Fiddler screenshot of form items):</p>
  
  <p><img src="https://i.stack.imgur.com/H4DZ0.png" alt="enter image description here"></p>
  
  <p>However, at the server, the default modelbinder instantiates the struct as zeros for each of its members. Everything else in the ViewModels were created by the ModelBinder without a problem.</p>
  
  <p>Do I need to create a custom ModelBinder for my custom struct?</p>
  
  <p><strong>Edit - adding more details</strong><br>
  The signature is:</p>
  
  <pre><code>public ActionResult ManageOrder([FromBody]ManageOrderEditModel model)
  </code></pre>
  
  <p>I've tried it without the FromBody attribute. Also, the fact that PricesAndDiscounts is a struct is njot the issue. I changed it to a class and all members come in as zeros, instead of the values you can see in Fiddler from the form.</p>
  
  <p><strong>ManageOrderEditModel</strong></p>
  
  <pre><code>public class ManageOrderEditModel
  {
      public DisplayOptionsInDropDownViewModel DisplayOptionsInDropDownViewModel { get; set; }
      public DisplayRowPriceViewModel DisplayRowPriceViewModel { get; set; }
  
      public int ID { get; set; }
      public int RegType { get; set; }
  }
  </code></pre>
  
  <p><strong>DisplayRowPriceViewModel</strong></p>
  
  <pre><code>public class DisplayRowPriceViewModel
  {
      public Discount Discount { get; set; }
      public int NumberOfAdditionalLocations { get; set; }
      public OrderStatus OrderStatus { get; set; }
      public double Price { get; set; }
      public PricesAndDiscounts PricesAndDiscounts { get; set; }
      public RegType  RegistrationType { get; set; }
      public decimal RowPrice { get; set; }
  }
  </code></pre>