public UserProfileBase UserProfileEdit(UserProfileBase newItem) { if (newItem != null) { var fetchObject = ds.UserProfile.Include("ApplicationUser").SingleOrDefault(e => e.Id == newItem.Id); int profilePicturePhotoId = fetchObject.MyProfilePictureId; if (fetchObject == null) { return(null); } else { ds.Entry(fetchObject).CurrentValues.SetValues(newItem); fetchObject.MyProfilePictureId = profilePicturePhotoId; ds.SaveChanges(); return(mapper.Map <UserProfileBase>(fetchObject)); } } else { return(null); } }
public ActionResult Edit(int?id, UserProfileBase newItem) { if (!ModelState.IsValid) { return(RedirectToAction("edit", new { id = newItem.Id })); } if (id.GetValueOrDefault() != newItem.Id) { return(RedirectToAction("index")); } // Attempt to do the update var editedItem = m.UserProfileEdit(newItem); if (editedItem == null) { return(RedirectToAction("edit", new { id = newItem.Id })); } else { return(RedirectToAction("Index")); } }
public void SetUserProfilePlanner(UserProfileBase userProfileBase) { this.userProfileBase = userProfileBase; }