Beispiel #1
0
        ///<summary>
        /// Updates information for a team
        /// </summary>
        public ActionResult UpdateTeamInformation(TeamViewModel iTeam)
        {
            ActionResult oResponse = null;
            var          userPO    = (IUserPO)Session["UserModel"];

            iTeam.User.Email     = userPO.Email;
            iTeam.User.RoleID_FK = userPO.RoleID_FK;

            // Ensure user is authenticated
            if (userPO.Email != null && userPO.RoleID_FK == (int)RoleEnum.Administrator)
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        // Map team from presentation to data objects
                        ITeamDO lTeamForm = TeamMapper.MapTeamPOtoDO(iTeam.Team);

                        // Passes form to be updated
                        _TeamDataAccess.UpdateTeam(lTeamForm, userPO.UserID);

                        oResponse = RedirectToAction("ViewAllTeams", "Maint");
                    }
                    catch (Exception ex)
                    {
                        ErrorLogger.LogError(ex, "UpdateTeamInformation", "Maint");
                        iTeam.ErrorMessage = "There was an issue with updating the selected team. Please try again. If the problem persists contact your IT team.";

                        oResponse = View(iTeam);
                    }
                }
                else
                {
                    oResponse = View(iTeam);
                }
            }

            return(oResponse);
        }
Beispiel #2
0
 public ActionResult UpdateTeam(TeamViewModel teamViewModel)
 {
     TeamDataAccess.UpdateTeam(Mapper.teamMap(teamViewModel.SingleTeam));
     return(RedirectToAction("ViewTeams"));
 }
 public ActionResult UpdateTeam(TeamPO Update)
 {
     teamData.UpdateTeam(mapper.SingleTeamMap(Update));
     return(RedirectToAction("ViewTeam", new { ViewID = Update.TeamID }));
 }