I wanna create simple API, for example - todo API.
Created model
public class Todo
{
public int Id { get; set; }
public string Title { get; set; }
public bool Completed { get; set; }
}
And than in code, I wanna create some methods. So I go to put method, start writing:
[HttpPut("{id}")]
public IActionResult Put(Todo todo, int id)
{
...
}
And than I don't know if I should check if id from URL is same as id from todo or I should ignore id from todo or create TodoUpdateDTO without id.
I know what whatever I would do - it will just work, but what is a good practice in .NET Core?