public bool UpdateUser(User u) { User user = GetUser(u.NickName); user.Name = u.Name; user.Email = u.Email; return true; }
//Remove um user public bool DeleteUser(User u) { if (!_users.ContainsKey(u.NickName)) return false; _users.Remove(u.NickName); userBoards.Remove(u.NickName); userVisBoard.Remove(u.NickName); userEditBoard.Remove(u.NickName); RemoveEdit(u.NickName); RemoveVis(u.NickName); return true; }
public ActionResult EditProfile(string userId, User u) { u.NickName = User.Identity.Name; _userRepo.UpdateUser(u); return RedirectToAction("Profile"); }
//Adiciona um user novo public bool CreateUser(User u) { if (!_users.ContainsKey(u.NickName)) { _users.Add(u.NickName, u); userBoards.Add(u.NickName, new LinkedList<int>()); userVisBoard.Add(u.NickName, new LinkedList<Pair>()); userEditBoard.Add(u.NickName, new LinkedList<Pair>()); letSee.Add(u.NickName, new Dictionary<string, LinkedList<int>>()); letEdit.Add(u.NickName, new Dictionary<string, LinkedList<int>>()); return true; } return false; }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { User pendentUser = new User { NickName = username, Password = password, Email = email, Role = "guest" }; if (_userRepo.CreateUser(pendentUser)) { status = MembershipCreateStatus.Success; } else { status = MembershipCreateStatus.DuplicateUserName; } return pendentUser; }