I'm looking to do partial updates on a web api controller action by using the Delta wrapper.<br /><br />I have a model like such:<br /><br />public class Person<br />{<br /> public Guid PersonId { get; set; }<br /><br /> public string FirstName { get; set; }<br /><br /> public string LastName { get; set; }<br /><br /> public bool IsActive { get; set; }<br /><br /> public int NumVacationDays { get; set; }<br /><br /> public double Salary { get; set; }<br />}<br /><br /><br />I have the api controller like such:<br /><br /> public void Put(Delta<Person> person)<br /> {<br /> var p = person.GetEntity();<br /><br /> Person existingPerson = _repository.Get(p.PersonId);<br /><br /> person.Patch(existingPerson);<br /><br /> _repository.Update();<br /><br /> return;<br /> }<br /><br />I make the call to the web api like such (using fiddler)<br /><br />url: http://localhost:49933/api/Person (PUT)<br /><br /><br />Response Body<br /> {<br /> "PersonId": "b269c49f-8a90-41d6-b102-7cfba3812b1c",<br /> "FirstName": "sample string 2",<br /> "LastName": "sample string 3",<br /> "IsActive": true,<br /> "NumVacationDays": 5,<br /> "Salary": 6.1<br /> }<br /><br />The controller is hit and all the data is populated other than the NumVacationDays (which is 0) and the PersonId (which defaults to 00000000-0000-0000-0000-000000000000)<br /><br />Does anyone know why the GUIDs and int fields are not populating from the json?
↧