Hi folks,
here is my object:
{"userID": 18,"firstName": "bob","lastName": "smith","age": 22,"education": [ {"eduID": 7,"teacher": "Kane","course": "Math", }, {"eduID": 8,"teacher": "John","course": "Biology", } ] }
I can update first name or last name but cannot update education as subarray e.g teacher or course.
[HttpPut("{id}")] public async Task<IActionResult> PutPerson([FromRoute] int id, [FromBody] Person person) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != person.userID) { return BadRequest(); } _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { ........ } return NoContent(); }
Any idea?
I am waiting for your response
Thanks in advance