Пример #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());
 }