I am following this tutorial( What's the currently recommended way of performing partial updates with Web API? ) to implement partial updates in my web api. But doing so i am getting an error:
Cannot convert lambda expression to type 'object[]' because it is not a delegate type
This is my code for partial updates/patch :
[AcceptVerbs("PATCH")]
public user PatchDocument(int id, Delta <user> user)
{
var serverUser =db.users.Find(u => u.iduser = id); // This is where i get error Find(u => u.iduser = id)
user.Patch(serverUser);
}
you could try
var serverUser =db.users.FirstOrDefault(u => u.iduser == id);
if(serverUser != null)
{
user.Patch(serverUser);
}
Edit Whoops needed ==
尝试这个:
var serverUser = db.users.Find(u => u.iduser == id); // == instead of =
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.