/// <summary> /// 団体申請情報を取得したDtoからViewModelを生成します。 /// </summary> public static RequestContinuedTeamViewModel FromDto(GetRequestTeamStateDto requestTeamState) { var viewModel = new RequestContinuedTeamViewModel { SeasonName = requestTeamState.SeasonName, TeamCode = requestTeamState.TeamCode, TeamName = requestTeamState.TeamName, RepresentativeName = requestTeamState.RepresentativeName, TeamId = requestTeamState.TeamId, TeamType = requestTeamState.TeamType, SeasonId = requestTeamState.SeasonId, RequestedFee = requestTeamState.RequestedFee, IsRequestDone = requestTeamState.IsRequestDone, }; if (viewModel.IsRequestDone) { viewModel.DisplayMessage = requestTeamState.IsApproved ? "受領しました。" : "申請済みです。"; } else { viewModel.DisplayMessage = $"{requestTeamState.SeasonName}の継続登録申込を行います。"; viewModel.IsDisplaySubmitButton = true; } return(viewModel); }
public async Task <ActionResult> RequestContinuedTeam(int teamId) { try { var requestTeamState = await this.useCase.GetRequestTeamState(teamId); return(this.View(RequestContinuedTeamViewModel.FromDto(requestTeamState))); } catch (NotFoundException) { return(this.NotFound()); } }
public async Task <ActionResult> RequestContinuedTeam([Bind( "TeamId", "TeamType", "RequestedFee", "SeasonId")] RequestContinuedTeamViewModel model) { try { // RequestTeamの発行 var dto = model.ToDto(); await this.useCase.AddRequestTeam(dto); return(this.RedirectToAction(nameof(RequestContinuedTeam), new { teamId = model.TeamId })); } catch (NotFoundException) { return(this.NotFound()); } }