Exemplo n.º 1
0
        public IActionResult UpdateUserBuildings(UserBuildings userBuildings)
        {
            foreach (var building in userBuildings.Buildings)
            {
                var index = GlobalVariables.Buildings.FindIndex(x => x.BuildingName == building.BuildingName);
                GlobalVariables.Buildings.RemoveAt(index);
                GlobalVariables.Buildings.Insert(index, building);
            }

            return(RedirectToAction($"Buildings", new { UserName = userBuildings.ActiveUser.Name }));
        }
Exemplo n.º 2
0
        public IActionResult Buildings(string username)
        {
            if (!GlobalVariables.ActiveSession.AllUsers.Any(x => x.Name == username))
            {
                RedirectToAction("Index");
            }

            var model = new UserBuildings(username);

            return(View(model));
        }