I want update family of a person who his name is pejman. This is my object Class:
public class Person
{
public int Id { get; set; }
public string FirstNa
For resolving this error i got values by ID from database stored in Var Temprc. Then updated the field Password which i wont to update. Then attached temprc to my Userregistrations model. Then Marked PasswordConfirm isModified. then Savechanges();
using (var db = new Entities())
{
var temprc = _reg.GetUserByID(Convert.ToInt32(Session["LogedUserID"]));
temprc.PasswordConfirm = U.NewPassword;
db.Userregistrations.Attach(temprc);
db.Entry(temprc).Property(x => x.PasswordConfirm).IsModified = true;
db.SaveChanges();
}