예제 #1
0
 public ActionResult FriendPlateList(string name)
 {
     using (UserRepository repo = new UserRepository())
     {
         return PartialView(repo.GetPotentialFriendListByNickname(name, CurrentUser.Instance.Current));
     }
 }
예제 #2
0
 public void Init(string email, UserRepository repository)
 {
     if (!string.IsNullOrEmpty(email))
     {
         User = repository.GetUser(email);
         User.LastActivity = DateTime.Now;
         repository.ForceSaveChanges();
     }
 }
예제 #3
0
        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();
        }
예제 #4
0
 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";
     }
 }
예제 #5
0
 public UserProvider(string name, UserRepository repository)
 {
     userIdentity = new UserIndentity();
     userIdentity.Init(name, repository);
 }
예제 #6
0
 public User ToUser()
 {
     UserRepository repo = new UserRepository();
     return repo.Accounts.Where(u => u.Id == this.UserId).FirstOrDefault();
 }
예제 #7
0
 public ActionResult TopPlayers()
 {
     UserRepository repo = new UserRepository();
     return View(repo.GetTopPlayers());
 }