Q:

Update single property of an entity using Entity Framework and ASP.NET MVC

I'm trying to use Entity Framework in an ASP.NET MVC web application.
Let's say I have an Entity "people", with some anagraphical details.
My web application has a view where, using Ajax, I can change my details one by one.
For example, I can change only the "name" of my entity, using an Ajax post.
What's the best practice to implement a method in my controller to perform this update on my "people" entity?
I would like to create a general "update" method, not a specific method for each single property. 
Thanks for helping me

A:

public ActionResult Update(int id, string propertyName, object propertyValue)
{
    using(var ctx = new Db())
    {
       var person = ctx.People.First(n => n.Id == id);
       Type t = person.GetType();
       PropertyInfo prop = t.GetProperty(propertyName);
       prop.SetValue(person, propertyValue, null);
       ctx.SaveChanges();
    }
    return Json(new { Success = true });
}

