Controller
[HttpPost]
public ActionResult EditUserProfile(UserProfiles _postedUserProfile)
{
UserProfiles orjinalUserProfile = entity.UserProfiles.Where(x => x.UserId == _postedUserProfile.UserId).Single();
orjinalUserProfile.AboutMe = _postedUserProfile.AboutMe;
orjinalUserProfile.Birthday = _postedUserProfile.Birthday;
orjinalUserProfile.Comments = _postedUserProfile.Comments;
...... // there are lines more
entity.SaveChanges();
return View();
}
I updated entity like above. But I think this way is not good. Is There any solutoin to update entity in a line, for example insert operation like entity.AddToUserProfiles
.
Thanks.