Esempio n. 1
0
        ///<summary>
        /// Gets form for creating a new User
        ///first, last, email, team, role(Admin, SM, TL)
        /// </summary>
        public ActionResult CreateUser()
        {
            ActionResult oResponse = null;

            // Ensure user is authenticated
            if (ModelState.IsValid)
            {
                List <ITeamDO> doTeamsList = _tda.GetAllTeams();
                List <TeamPO>  teamsList   = new List <TeamPO>();
                foreach (TeamDO teamDO in doTeamsList)
                {
                    TeamPO teamPO = Mapper.Map <TeamDO, TeamPO>(teamDO);
                    teamsList.Add(teamPO);
                }
                ViewBag.TeamsList = teamsList;

                //TODO: pull all roles names and Ids for dropDown List

                //refresh Menu for User
                Session["MenuItems"] = HomeController.GetMenuItem(HttpContext.Session);

                oResponse = RedirectToAction("Dashboards", "Home");
            }
            else
            {
                // User doesn't have access, redirect
                oResponse = RedirectToAction("Index", "Home");
            }
            return(oResponse);
        }
 public ActionResult CreateTeam(TeamPO Create)
 {
     PopulateDropDowns();
     Create.CreatorID = (int)Session["UserID"];
     teamData.CreateTeam(mapper.SingleTeamMap(Create));
     return(RedirectToAction("UserTeams"));
 }
        public static ITeamDO MapTeamPOtoDO(TeamPO teamPO)
        {
            ITeamDO oTeam = new TeamDO();

            oTeam.TeamID       = teamPO.TeamID;
            oTeam.Name         = teamPO.Name;
            oTeam.Comment      = teamPO.Comment;
            oTeam.Active       = teamPO.Active;
            oTeam.RunningTotal = teamPO.RunningTotal;

            return(oTeam);
        }
        public static TeamPO MapTeamDOtoPO(ITeamDO teamDO)
        {
            var oTeam = new TeamPO();

            oTeam.TeamID       = teamDO.TeamID;
            oTeam.Name         = teamDO.Name;
            oTeam.Comment      = teamDO.Comment;
            oTeam.Active       = teamDO.Active;
            oTeam.RunningTotal = teamDO.RunningTotal;

            return(oTeam);
        }
        public ActionResult ViewTeam(int ViewID)
        {
            PopulateDropDowns();
            TeamDAO ChosenTeam = new TeamDAO();

            ChosenTeam.TeamID = ViewID;
            TeamPO     MappedTeam  = mapper.SelectTeamMap(teamData.SelectTeam(ChosenTeam));
            List <int> chosenTypes = mapper.TypeIDMap(MappedTeam);
            TypeDAO    FinalValues = teamData.CalculateTypes(chosenTypes);

            MappedTeam.MaxName  = FinalValues.MaxName;
            MappedTeam.Max2Name = FinalValues.Max2Name;
            MappedTeam.MinName  = FinalValues.MinName;
            MappedTeam.Min2Name = FinalValues.Min2Name;
            return(View(MappedTeam));
        }
 public ActionResult UpdateTeam(TeamPO Update)
 {
     teamData.UpdateTeam(mapper.SingleTeamMap(Update));
     return(RedirectToAction("ViewTeam", new { ViewID = Update.TeamID }));
 }