public ActionResult FriendPlateList(string name) { using (UserRepository repo = new UserRepository()) { return PartialView(repo.GetPotentialFriendListByNickname(name, CurrentUser.Instance.Current)); } }
public void Init(string email, UserRepository repository) { if (!string.IsNullOrEmpty(email)) { User = repository.GetUser(email); User.LastActivity = DateTime.Now; repository.ForceSaveChanges(); } }
public ActionResult Index(Guid? profileId) { if (profileId.HasValue) { UserRepository repo = new UserRepository(); User user = repo.GetUser(profileId.Value); if (user != null) return View(user); } //todo: add proper error message (Profile not found) Response.StatusCode = 404; return new EmptyResult(); }
public string ManageFriend(Guid? id) { using (UserRepository repo = new UserRepository()) { User curUser = repo.GetUser(CurrentUser.Instance.Current.Id); if (Request.HttpMethod == "PUT") curUser.Friends.Add(repo.GetUser(id.Value)); else if (Request.HttpMethod == "DELETE") curUser.Friends.Remove(repo.GetUser(id.Value)); else { Response.StatusCode = 404; return ""; } repo.ForceSaveChanges(); return "success"; } }
public UserProvider(string name, UserRepository repository) { userIdentity = new UserIndentity(); userIdentity.Init(name, repository); }
public User ToUser() { UserRepository repo = new UserRepository(); return repo.Accounts.Where(u => u.Id == this.UserId).FirstOrDefault(); }
public ActionResult TopPlayers() { UserRepository repo = new UserRepository(); return View(repo.GetTopPlayers()); }