I have a problem in my UserRepository in which I want to update a user. I dont want certain fields updated, such as password, unless specified. For example, When I pass the
public User Save(User user)
{
if (user.UserId > 0)
{
User dbUser = context.Users.FirstOrDefault(u => u.UserId == user.UserId);
//What do I do here?
dbUser.Email = user.Email
user = dbUser;
}
else
{
context.Users.AddObject(user);
}
context.SaveChanges();
return user;
}