コード例 #1
0
        public async Task <ActionResult> SaveInstall(string teamId, [Bind(Include = "Id,Date,TeamInstallId,Title,Description,Active,CoachId")] TeamInstallDTO teamInstall)
        {
            TeamViewModel model = new TeamViewModel();

            teamInstall.TeamId = teamId.Trim();
            if (!string.IsNullOrEmpty(Request.Form["DateIssue"]))
            {
                teamInstall.Date = Convert.ToDateTime(Request.Form["DateIssue"]);
            }
            if (await model.CreateUpdateTestInstall(teamInstall))
            {
                if (!string.IsNullOrEmpty(teamInstall.Id))
                {
                    List <TeamUser> teamUsers = await model.GetUsersByTeamId(teamInstall.TeamId);

                    foreach (var user in teamUsers)
                    {
                        var emailResponse = await model.SendInstallNotification(new EmailDTO { To = user.Email, Subject = "PlayBool5 Install Notification", Body = "New Install '" + teamInstall.Title + "' is created in your team" });
                    }
                }

                TempData["ErrorMessage"] = "Install added to team";
            }
            else
            {
                TempData["ErrorMessage"] = "There is some problem in adding install to team";
            }

            ActionResult result;

            result = RedirectToAction("Install", new { teamId = teamId });
            return(await Task.FromResult(result));
        }
コード例 #2
0
 public async Task <bool> CreateUpdateTestInstall(TeamInstallDTO teamInstall)
 {
     return(await new RestHelper().Post("api/TeamManagement/CreateTeamInstall", teamInstall));
 }
コード例 #3
0
        public async Task <ActionResult> SavePlayToTeam(string Id, string teamId, string InstallPlay, TeamInstallDTO model)
        {
            TeamViewModel viewModel = new TeamViewModel();

            if (InstallPlay != "-1")
            {
                if (await viewModel.InsertInstallPlay(Id, InstallPlay))
                {
                    TempData["ErrorMessage"] = "Play added to team";
                }
                else
                {
                    TempData["ErrorMessage"] = "There is some problem in adding play to team";
                }
            }
            else
            {
                TempData["ErrorMessage"] = "Please select play";
            }

            ActionResult result;

            result = RedirectToAction("Install", new { teamId = teamId });
            return(await Task.FromResult(result));
        }