public ActionResult Index(string name) { if (string.IsNullOrEmpty(name)) { return(View("Welcome")); } var user = RavenService.GetUser(RavenSession, name); if (user == null) { return(View("NewUser", new User { UserName = name })); } var isAuthenticated = IsAuthenticated(user); if (user.IsPublic || isAuthenticated) { var challenges = RavenService.GetAllChallenges(RavenSession); var history = RavenService.GetHistory(RavenSession, user); Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE"); var boardViewModel = new BoardViewModel { Challenges = challenges.Where(m => m.Hide == false).ToList(), TotalPoints = CalculatePoints(challenges, user), CurrentUser = user, IsAuthenticated = isAuthenticated, History = history }; return(View("Index", boardViewModel)); } return(RedirectToAction("Index", "Authentication", new { name = user.UserName })); }
// // GET: /Admin/ public ActionResult Index() { //get all challenges from database var model = new List <Challenge>(); model = RavenService.GetAllChallenges(RavenSession); return(View(model)); }
public ActionResult Count() { //get all users var users = RavenService.GetAllUsers(RavenSession); var challenges = RavenService.GetAllChallenges(RavenSession); var model = new List <Count>(); // foreach foreach (var user in users) { var count = new Count() { Name = user.Name + "(" + user.UserName + ")", Points = CalculatePoints(challenges, user) }; model.Add(count); } //get all activities for user return(View(model)); }