I have written a method that patches one field of a user, the code for that method is
[AcceptVerbs("PATCH")]
public user PatchUser(user user)
{
user serverUser = db.users.Find(user.iduser);
serverUser.profilepic=user.profilepic;
db.SaveChanges();
return serverUser;
}
Right now i am using this code to patch by json , json is :
{
iduser: 123,
profilepic: "My profile link "
}
So how to modify this code to allow mutliple patches like i want to use the same url to patch other properties too. Like if i want to patch username the json should be:
{
iduser: 123,
username: "SomeUserName "
}