// GET: Dashboard/AccountUsers/Edit public ActionResult Edit() { membershipUser = Membership.GetUser(User.Identity.Name, true) as ToMembershipUser; EditAccountViewModel user = new EditAccountViewModel(); user.ID = membershipUser.ID; user.FirstName = membershipUser.FirstName; user.LastName = membershipUser.LastName; user.Email = membershipUser.Email; user.CurrentPassword = null; user.NewPassword = null; user.ConfirmPassword = null; user.MediaID = membershipUser.MediaID; user.Media = membershipUser.Media; return View(user); }
public override MembershipUser GetUser(string query, bool userIsOnline) { if (string.IsNullOrEmpty(query)) return null; var db = (AccountUser)null; // ...get data from db if (query.Contains("@")){ db = _repository.GetFreshQuery(x => x.Email == query).FirstOrDefault(); } else { string firstName = query; string lastName = null; if (query.Contains(" ")) { string[] names = query.Split(null); firstName = names[0]; lastName = names[1]; } // ...get data from db db = _repository.GetFreshQuery(x => x.FirstName == firstName && x.LastName == lastName).FirstOrDefault(); } if (db == null) return null; ToMembershipUser user = new ToMembershipUser( "AccountUserMembershipProvider", db.FirstName + " " + db.LastName, db.ID, db.Email, "", "", true, false, DateTime.Now, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue); // Fill additional properties user.ID = db.ID; user.Email = db.Email; user.FirstName = db.FirstName; user.LastName = db.LastName; user.Password = db.Password; user.MediaID = db.MediaID; user.Media = db.Media; user.Identity = db.Identity; user.CreatedAt = db.CreatedAt; user.UpdatedAt = db.UpdatedAt; return user; }