public ActionResult ViewMatch(int id) { if (Request.Cookies["user"] == null) { return(RedirectToAction("Login", "User")); } string username = Logged_username(); Set_TempData(username); var dal = new Competition_services(); var dal2 = new Team_services(); var dal3 = new Player_services(); MatchViewModel model = new MatchViewModel(); model.Match = dal.One_match(id); model.HomePoints = dal.HomePoints(model.Match); model.AwayPoints = dal.AwayPoints(model.Match); if (dal3.Check_existing(model.Match.Match_contestants.ElementAt(0).Contestant.ID) != null) { model.HomeContestant = dal3.Check_existing(model.Match.Match_contestants.ElementAt(0).Contestant.ID).Name; model.AwayContestant = dal3.Check_existing(model.Match.Match_contestants.ElementAt(1).Contestant.ID).Name; } else { model.HomeContestant = dal2.Check_existing(model.Match.Match_contestants.ElementAt(0).Contestant.ID).Name; model.AwayContestant = dal2.Check_existing(model.Match.Match_contestants.ElementAt(1).Contestant.ID).Name; } model.Events = dal.Match_events(model.Match.ID); return(View(model)); }
public void SetFinalMatchResult(MatchViewModel matchViewModel, string userId) { var match = this.context.GetMatch(matchViewModel.MatchId); match.DateOfGame = DateTime.Today; match.Status = MatchStatus.WaitingForConfirmation; if (match.Result != null) { match.Result.CreatedBy = userId; this.UpdateSets(matchViewModel, match.Result); } else { match.Result = new MatchResult() { CreatedBy = userId, Type = matchViewModel.Type, Sets = this.GetSets(matchViewModel) }; } match.Result.Winner = this.IsChellangerWinner(match) ? match.Chellanger : match.Defender; this.context.UpdateMatch(match); }
private Gameweek AddOrUpdateGameweek(MatchViewModel matchModel) { var gameweek = data.Gameweeks.All().FirstOrDefault(g => g.Name == matchModel.Gameweek); int gamewekIndex = matchModel.Gameweek.LastIndexOf(' '); int gameweekNumber = int.Parse(matchModel.Gameweek.Substring(gamewekIndex + 1)); var previousGameweek = data.Gameweeks.GetById(gameweekNumber - 1); if (previousGameweek != null) { startDate = previousGameweek.EndDate; } if (gameweek == null) { var newGameweek = new Gameweek() { Id = gameweekNumber, Name = matchModel.Gameweek, StartDate = startDate, EndDate = matchModel.MatchDate.AddDays(1) }; data.Gameweeks.Add(newGameweek); data.SaveChanges(); gameweek = data.Gameweeks.GetById(newGameweek.Id); } else { gameweek.StartDate = startDate; gameweek.EndDate = matchModel.MatchDate.AddDays(1); } return(gameweek); }
// GET: Match/Create public ActionResult Create(string Category = null, bool weaponReq = false, string message = "") { List <Game> games = game.Collection().ToList(); List <Season> seasons = Iseason.Collection().ToList(); List <User> users = Iuser.Collection().ToList(); ViewBag.Message = message; // add N/A users.Add(new User { FirstName = "N/A", UserId = "0" }); MatchViewModel viewModel = new MatchViewModel { ListOfGames = games, ListOfUsers = users.OrderBy(a => a.UserId), Game = games.First(a => a.GameName == Category) }; viewModel.ListOfSeasons = seasons.Where(a => a.GameId == viewModel.Game.GameId).OrderBy(a => a.SeasonNumber); viewModel.ListOfFields = Ifield.Collection().Where(a => a.Module == "Match").ToList(); return(View(viewModel)); }
public ActionResult Create(MatchViewModel viewModel, Match match, string category = "") { IEnumerable <Game> gameTemp; ViewBag.Message = ""; gameTemp = game.Collection(); viewModel.Match.PlayerWin = Request.Form["WinPlayer"]; viewModel.Match.SeasonId = Convert.ToInt64(Request.Form["Season"]); viewModel.Match.PlayerIdLose = Request.Form["LossPlayer"]; viewModel.Game = gameTemp.First(a => a.GameName == category); // insert to match viewModel.Match.GameId = viewModel.Game.GameId; viewModel.IsErrorMessage = false; if (category == "Billiards") { if (viewModel.Match.PlayerIdLose == "0" || viewModel.Match.PlayerWin == "0") { viewModel.IsErrorMessage = true; ViewBag.Message = "Winning and Losing player is required."; return(RedirectToAction("Create", "Match", new { Category = category, message = ViewBag.Message })); } } Imatch.Insert(viewModel.Match); Imatch.Commit(); return(RedirectToAction("Index", "GameStats", new { Category = category })); }
static void Replay_Created(object sender, FileSystemEventArgs e) { try { Thread.Sleep(3000); if (!FileInvestigator.IsFileFree(e.FullPath, 25)) { return; } ReplayMapper mapper = new ReplayMapper(Config.PlayerName); var match = mapper.ParseReplay(e.FullPath); if (match != null) { MatchViewModel.ProcessMatch(match); dataStore.AddMatch(match); } dataStore.Save(); ApplicationState.MatchViewModel.UpdateBindings(); } catch (Exception) { } }
public JsonResult CreateMatch([DataSourceRequest] DataSourceRequest request, MatchViewModel match) { if (match != null && ModelState.IsValid) { var hostTeam = this.Data.Teams.All().FirstOrDefault(x => x.Name == match.Host); var visitorTeam = this.Data.Teams.All().FirstOrDefault(x => x.Name == match.Visitor); var gameweek = this.Data.Gameweeks.All().FirstOrDefault(g => g.Name == match.Gameweek); var matchExists = this.Data.Matches.All().FirstOrDefault(m => m.Host.Name == match.Host && m.Visitor.Name == match.Visitor); if (matchExists == null) { var newMatch = new Match { Host = hostTeam, Visitor = visitorTeam, HostScore = match.HostScore, VistorScore = match.VisitorScore, Gameweek = gameweek, MatchDate = match.MatchDate }; this.Data.Matches.Add(newMatch); this.Data.SaveChanges(); } match.Id = match.Id; } return(Json(new[] { match }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet)); }
public ActionResult Index(MatchViewModel model) { try { ViewBag.SearchModel = model; var request = new FilteredModel <Match>(); var offset = (model.ThisPageIndex - 1) * model.ThisPageSize; var result = _mapper.Map <IList <MatchViewModel> >(_matchService.GetPaging(_mapper.Map <Match>(model), out long totalCount, model.PageOrderBy, model.PageOrder, offset, model.ThisPageSize)); ViewBag.OnePageOfEntries = new StaticPagedList <MatchViewModel>(result, model.ThisPageIndex, model.ThisPageSize, (int)totalCount); } catch (Exception ex) { _logger.Error(ex); if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource)) { ModelState.AddModelError(string.Empty, ex.Message); } else { ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError); } } return(View()); }
// GET: Match public ActionResult Index(int Id) { ApplicationDbContext db = new ApplicationDbContext(); var viewModel = new MatchViewModel(); //init match info viewModel.Match = db.Match.OrderByDescending(m => m.Date).FirstOrDefault(m => m.MatchId == Id); var userName = User.Identity.GetUserName(); if (viewModel.Match == null) { return(RedirectToAction("Index", "Home")); } else { if (viewModel.Match.Opponent1 != userName && viewModel.Match.Opponent2 != userName) { return(RedirectToAction("Index", "Home")); } } viewModel.Opponent1 = db.Users.FirstOrDefault(u => u.UserName == viewModel.Match.Opponent1); viewModel.Opponent2 = db.Users.FirstOrDefault(u => u.UserName == viewModel.Match.Opponent2); viewModel.IsOpponent1 = User.Identity.GetUserName() == viewModel.Opponent1.UserName; ViewBag.Name = userName; return(View(viewModel)); }
private UserBetResultViewModel ToBetResultViewModel(MatchViewModel match, BetResultEntity betResult, MatchBetEntity bet) { return(new UserBetResultViewModel { AwayTeam = match.AwayTeam, AwayTeamCode = match.AwayTeamCode, AwayTeamGoals = match.AwayTeamGoals.Value, AwayTeamPenalties = match.AwayTeamPenalties, HomeTeam = match.HomeTeam, HomeTeamCode = match.HomeTeamCode, HomeTeamGoals = match.HomeTeamGoals.Value, HomeTeamPenalties = match.HomeTeamPenalties, PenaltiesDefinition = match.PenaltiesDefinition, PlayedOn = match.PlayedOn, Stage = match.Stage, BetAwayTeamGoals = bet.AwayGoals, BetAwayTeamPenalties = bet.AwayPenalties, BetHomeTeamGoals = bet.HomeGoals, BetHomeTeamPenalties = bet.HomePenalties, Points = betResult.Points, HitResult = betResult.HitResult, HitExactResult = betResult.HitExactResult, ExtraPoint = betResult.ExtraPoint, BetPenalties = match.Stage.SupportPenalties() && bet.AwayGoals == bet.HomeGoals }); }
public MatchViewModel ToViewModel(Match model, int subNiveau = 3) { if (subNiveau == 0 || model == null) { return(null); } var matchModel = new MatchViewModel { Id = model.Id, Done = model.Done, StartTime = model.StartTime, StartTimeStr = model.StartTime.HasValue ? TimeZone.CurrentTimeZone.ToLocalTime(model.StartTime.Value).ToString("dd/MM HH:mm") : null, EndTime = model.EndTime, EndTimeStr = model.EndTime.HasValue ? TimeZone.CurrentTimeZone.ToLocalTime(model.EndTime.Value).ToString("dd/MM HH:mm") : null, TimeSpan = model.TimeSpan, TimeSpanStr = model.TimeSpan?.ToString(@"mm\:ss"), ScoreDiff = model.ScoreDiff, GoalsTeamRed = model.EndGoalsTeamRed - model.StartGoalsTeamRed, StartGoalsTeamRed = model.StartGoalsTeamRed, EndGoalsTeamRed = model.EndGoalsTeamRed, GoalsTeamBlue = model.EndGoalsTeamBlue - model.StartGoalsTeamBlue, StartGoalsTeamBlue = model.StartGoalsTeamBlue, EndGoalsTeamBlue = model.EndGoalsTeamBlue, TeamRedId = model.RedTeamId, TeamBlueId = model.BlueTeamId, TeamRed = ToViewModel(model.RedTeam, subNiveau - 1), TeamBlue = ToViewModel(model.BlueTeam, subNiveau - 1), GameResult = model.RedDrawBlueGameResult, ScoreTeamRed = model.RedTeam.Score, ScoreTeamBlue = model.BlueTeam.Score, }; return(matchModel); }
public IActionResult EditST(MatchViewModel model) { Match match = matchRepository.Matches.FirstOrDefault(m => m.MatchID == model.Match.MatchID); match.HomeFouls = model.Match.HomeFouls; match.HomeCorners = model.Match.HomeCorners; match.HomeShotsOnTarget = model.Match.HomeShotsOnTarget; match.AwayFouls = model.Match.AwayFouls; match.AwayCorners = model.Match.AwayCorners; match.AwayShotsOnTarget = model.Match.AwayShotsOnTarget; if (ModelState.IsValid) { matchRepository.Save(match); TempData["message"] = $"Match ID {model.Match.MatchID} has been saved."; return(View("Detail", new MatchViewModel { Match = match })); } else { return(View(model)); } }
public async Task <IActionResult> UpdateMatchScore(string matchId) { var matchQuery = new GetMatchesDetailByStrId(matchId); var response = await _mediator.Send(matchQuery); MatchViewModel matchesvm = new MatchViewModel(); #region ManualMapping matchesvm.MatchId = response.MatchId; matchesvm.MatchNumber = response.MatchNumber; matchesvm.DateMatch = response.DateMatch; matchesvm.TimeMatch = response.TimeMatch; matchesvm.MatchYear = response.MatchYear; matchesvm.SeasonId = response.SeasonId; matchesvm.SeasonName = response.SeasonName; matchesvm.Round = response.Round; matchesvm.Stage = response.Stage; matchesvm.SubStage = response.SubStage; matchesvm.HTeam = response.HTeam; matchesvm.HGoal = response.HGoal; matchesvm.HTeamCode = response.HTeamCode; matchesvm.GGoal = response.GGoal; matchesvm.GTeam = response.GTeam; matchesvm.GTeamCode = response.GTeamCode; matchesvm.WinNote = response.WinNote; matchesvm.Stadium = response.Stadium; matchesvm.Referee = response.Referee; matchesvm.Visistors = response.Visistors; #endregion return(View(matchesvm)); //return View(); }
//public ActionResult Create([ModelBinder(typeof(MatchBinder))]Match match) public ActionResult Create(int boardId, MatchViewModel match) { try { if (ModelState.IsValid) { _service.CreateMatch(boardId, HttpContext.User.Identity.Name, match.Loser, match.WinnerComment, match.Tie); } } catch (ServiceException ex) { ModelState.AddModelError("", ex.Message); return(View(new MatchViewModel { Board = _repository.GetBoardByIdWithCompetitors(boardId), Loser = match.Loser, WinnerComment = match.WinnerComment, Tie = match.Tie })); } TempData["StatusMessage"] = "Your match has been successfully reported."; return(RedirectToAction("List", new { boardId })); }
public virtual ActionResult Create(long matchDayId) { var model = new MatchViewModel(); model.MatchDayId = matchDayId; return(View(model)); }
private async Task<Match> ConvertMatchViewModel(MatchViewModel matchViewModel) { var teamA = await _context.Teams.FirstAsync(t => t.Name == matchViewModel.TeamA); var teamB = await _context.Teams.FirstAsync(t => t.Name == matchViewModel.TeamB); return new Match { Id = matchViewModel.Id, MatchDateTime = matchViewModel.MatchDateTime, TeamScores = new List<TeamMatchScore> { new TeamMatchScore { Score = matchViewModel.TeamAScore, Team = teamA, TeamId = teamA.Id }, new TeamMatchScore { Score = matchViewModel.TeamBScore, Team = teamB, TeamId = teamB.Id } } }; }
/// <summary> /// Method to get record of a match. /// </summary> /// <param name="matchId"></param> /// <returns></returns> public MatchViewModel MatchsGet(int matchId) { MatchViewModel result = new MatchViewModel(); using (SqlConnection sqlConnection = new SqlConnection(base.ConnectionString)) { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("MatchsGet", sqlConnection); sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure; sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@MatchID", matchId); using (sqlDataAdapter) { DataTable dataTable = new DataTable(); sqlConnection.Open(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { result = dataTable.ToList <MatchViewModel>().FirstOrDefault(m => m.MatchID == matchId); } } } return(result); }
public async Task <IActionResult> CreateMatch(bool shack = false) { var user = await _userservice.getUserFromCp(HttpContext.User); var servers = (await _pavlovServerService.FindAllServerWhereTheUserHasRights(HttpContext.User, user)) .Where(x => x.ServerType == ServerType.Event) .ToList(); // and where no match is already running if (shack) { servers = servers.Where(x => x.Shack).ToList(); } var match = new MatchViewModel { AllTeams = (await _teamService.FindAll()).ToList(), AllPavlovServers = servers.Prepend(new PavlovServer() { Id = 0, Name = "-- please select --" }).ToList(), Shack = shack }; return(View("Match", match)); }
public async Task <IActionResult> SaveMatch(MatchViewModel match) { var realmatch = new Match(); // make from viewmodel right model if (match.Id != 0) //edit or new { var user = await _userservice.getUserFromCp(HttpContext.User); var servers = await _matchService.FindAllMatchesWhereTheUserHasRights(HttpContext.User, user); if (!servers.Select(x => x.Id).Contains(match.Id)) { return(Forbid()); } realmatch = await _matchService.FindOne(match.Id); if (realmatch.Status != Status.Preparing) { return(BadRequest("The match already started so you can not change anything!")); } } if (await _matchService.SaveMatchToService(match, realmatch)) { return(new ObjectResult(true)); } return(BadRequest("Could not save match! Internal Error!")); }
public async Task <MatchResultViewModel> ReportMatchAsync(MatchResultViewModel matchResult, CancellationToken ct = default(CancellationToken)) { MatchResult reportMatch = new MatchResult() { MatchResultId = matchResult.MatchResultId, MatchId = matchResult.MatchId, AwayTeamScore = matchResult.AwayTeamScore, AwayTeamId = matchResult.AwayTeamId, HomeTeamScore = matchResult.HomeTeamScore, HomeTeamId = matchResult.HomeTeamId, LeagueId = matchResult.LeagueId, // mark this match as completed Status = MatchStatus.Completed }; // home team's score will always be first reportMatch.Score = $"{matchResult.HomeTeamScore} : {matchResult.AwayTeamScore}"; await this.SetWinnerLoserTeamNames(reportMatch); matchResult = MatchResultConverter.Convert(await this._sessionScheduleRepository.ReportMatchAsync(reportMatch, ct)); // retrieve session id MatchViewModel matchViewModel = MatchConverter.Convert(await this._sessionScheduleRepository.GetMatchByIdAsync(matchResult.MatchId)); if (matchViewModel != null) { matchResult.SessionId = matchViewModel.SessionId; } return(matchResult); }
/// <summary> /// Saves a match. /// </summary> /// <param name="match">Match.</param> public void SaveMatch(MatchViewModel match) { var awayTeam = _dbManager.GetTeams(t => t.Name == match.AwayTeam && t.CompetitionName == match.CompetitionName).FirstOrDefault(); if (awayTeam == null) { _dbManager.SaveTeam(new Team { CompetitionName = match.CompetitionName, Name = match.AwayTeam, ShortName = match.AwayTeamShort }); } var homeTeam = _dbManager.GetTeams(t => t.Name == match.HomeTeam && t.CompetitionName == match.CompetitionName).FirstOrDefault(); if (homeTeam == null) { _dbManager.SaveTeam(new Team { CompetitionName = match.CompetitionName, Name = match.HomeTeam, ShortName = match.HomeTeamShort }); } if (match.AwayScore != null) { _dbManager.SaveScore(match.AwayScore.ToModel()); } if (match.HomeScore != null) { _dbManager.SaveScore(match.HomeScore.ToModel()); } _dbManager.SaveMatch(match.ToModel()); }
// GET: Matches/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MatchDTO matchDTO = await service.GetMatch(id.Value); if (matchDTO == null) { return(HttpNotFound()); } MatchViewModel viewmodel = new MatchViewModel { Id = matchDTO.Id, DateTime = matchDTO.DateTime, G1P1Score = matchDTO.G1P1Score, G1P2Score = matchDTO.G1P2Score, G2P1Score = matchDTO.G2P1Score, G2P2Score = matchDTO.G2P2Score, G3P1Score = matchDTO.G3P1Score, G3P2Score = matchDTO.G3P2Score, PlayerId1 = matchDTO.PlayerId1, PlayerId2 = matchDTO.PlayerId2 }; var players = await playerService.GetPlayersAsync(); viewmodel.LoadPlayersIntoSelectList(players); return(View(viewmodel)); }
public IActionResult AddMatch(MatchViewModel viewModel, List <BettingOption> bo) { viewModel.Match.BettingOptions = bo; MatchLogic.AddMatch(viewModel.Match); return(RedirectToAction("AddMatch", "Admin")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,DateTime,G1P1Score,G1P2Score,G2P1Score,G2P2Score,G3P1Score,G3P2Score,PlayerId1,PlayerId2")] MatchViewModel viewmodel) { if (ModelState.IsValid) { MatchDTO matchDTO = new MatchDTO { Id = viewmodel.Id, DateTime = viewmodel.DateTime, G1P1Score = viewmodel.G1P1Score, G1P2Score = viewmodel.G1P2Score, G2P1Score = viewmodel.G2P1Score, G2P2Score = viewmodel.G2P2Score, G3P1Score = viewmodel.G3P1Score, G3P2Score = viewmodel.G3P2Score, PlayerId1 = viewmodel.PlayerId1, PlayerId2 = viewmodel.PlayerId2 }; await service.UpdateMatch(matchDTO); return(RedirectToAction("Index")); } var players = await playerService.GetPlayersAsync(); viewmodel.LoadPlayersIntoSelectList(players); return(View(viewmodel)); }
private async Task<Match> ConvertMatchViewModelToExisting(MatchViewModel matchViewModel) { var existing = await _matchesManager.GetMatchByIdAsync(matchViewModel.Id); existing.MatchDateTime = matchViewModel.MatchDateTime; var teamA = await _context.Teams.FirstAsync(x => x.Name == matchViewModel.TeamA); var teamB = await _context.Teams.FirstAsync(x => x.Name == matchViewModel.TeamB); existing.TeamScores.Clear(); existing.TeamScores = new List<TeamMatchScore> { new TeamMatchScore { Score = matchViewModel.TeamAScore, Team = teamA, TeamId = teamA.Id }, new TeamMatchScore { Score = matchViewModel.TeamBScore, Team = teamB, TeamId = teamB.Id } }; return existing; }
/// <summary> /// This method is for an ongoing game. It takes a gameViewModel object containing the MatchID, and both playerIDs, and the users Choice. /// Then creates a.... /// If so, the game is updated to reflect the winner. /// It not, the game is updated to reflect the latest round winner, and a new round is prepared with a computer Choice and returned. /// </summary> /// <param name="matchViewModel"></param> /// <returns></returns> public MatchViewModel PlayingGame(MatchViewModel matchViewModel) { //first decide on a round winner by calling EvaluateRound(match) which will evaluate the round winner AND update the match matchViewModel = EvaluateRound(matchViewModel); //if there is a match winner, return the commpleted match. if (matchViewModel.MatchWinner() != null) { // this is where you would fully populate the matchViewModel to display the complete game to the user. Player p1 = _repository.GetPlayerById(matchViewModel.Player1); Player p2 = _repository.GetPlayerById(matchViewModel.Player2); matchViewModel.Player1Fname = p1.Fname; matchViewModel.Player1Lname = p1.Lname; matchViewModel.Player2Fname = p2.Fname; matchViewModel.Player2Lname = p2.Lname; return(matchViewModel); } else // if there is no winner yet, get another round and return. { //matchViewModel.Rounds.Add(GetNextRound()); // we'll also get the computers choice before sending it to the user to choose their Choice. //matchViewModel.Rounds[matchViewModel.Rounds.Count - 1].Player1Choice = GetComputerChoice(); return(matchViewModel); } }
public async Task <IActionResult> Index() { await matchesService.DeleteOldMatchesAsync(); await matchesService.CheckAndGiveResultsToMatchesAsync(); var matches = await matchesService.GetUnfinishedMatchesAsync(); var matchViewModels = new List <MatchViewModel>(); foreach (var match in matches) { var matchViewModel = new MatchViewModel { FirstTeamName = match.MatchTeams.ToArray()[0].Team.Name, SecondTeamName = match.MatchTeams.ToArray()[1].Team.Name, MatchId = match.Id, StartingTime = match.StartingTime }; matchViewModels.Add(matchViewModel); } return(View(matchViewModels)); }
// GET: Matches/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var match = await _context.Matches.FindAsync(id); if (match == null) { return(NotFound()); } var teams = _context.Teams.Select(t => new SelectListItem(t.Name, t.Id.ToString())); var matchViewModel = new MatchViewModel() { SelectedTeam1 = match.Team1Id.ToString(), SelectedTeam2 = match.Team2Id.ToString(), Status = match.Status, Team1Score = match.Team1Score, Team2Score = match.Team2Score, Teams1 = teams, Teams2 = teams, }; return(View(matchViewModel)); }
public IHttpActionResult SaveMatch(MatchViewModel match) { try { var efMatch = new Match { Date = match.Date, User1Id = match.User1Id, User1Points = 0, User2Id = match.User2Id, User2Points = 0, IsActive = true, MatchType = match.MatchTypeId }; var matrix = GetHandicap(match.User1Id, match.User2Id); int minWins = matrix.Player1Wins < matrix.Player2Wins ? matrix.Player1Wins : matrix.Player2Wins; //AddNewGame(ref efMatch, 1); if (match.MatchTypeId == 2) { SeedMatch(ref efMatch, matrix); } _db.Matches.Add(efMatch); _db.SaveChanges(); return(Ok(efMatch.ToViewModel(null, true))); } catch (Exception ex) { return(InternalServerError(ex)); } }
// GET: Matches public async Task <ActionResult> Index() { List <MatchDTO> matchesDTO = await service.GetMatchesAsync(); List <MatchViewModel> viewmodels = new List <MatchViewModel>(); var players = await playerService.GetPlayersAsync(); foreach (MatchDTO dto in matchesDTO) { MatchViewModel single = new MatchViewModel { Id = dto.Id, DateTime = dto.DateTime, G1P1Score = dto.G1P1Score, G1P2Score = dto.G1P2Score, G2P1Score = dto.G2P1Score, G2P2Score = dto.G2P2Score, G3P1Score = dto.G3P1Score, G3P2Score = dto.G3P2Score, PlayerId1 = dto.PlayerId1, PlayerId2 = dto.PlayerId2 }; single.LoadPlayersIntoSelectList(players); viewmodels.Add(single); } return(View(viewmodels)); }
public UpdateRealmBehavior(MatchViewModel viewModel) { _viewModel = viewModel; }
public EntityViewModelStateChangedBehavior(MatchViewModel viewModel) { _viewModel = viewModel; }
/// <summary>Initializes a new instance of the ConnectionStateChangedBehavior class.</summary> /// <param name="viewModel">View model to control.</param> public ConnectionStateChangedBehavior(MatchViewModel viewModel) { _viewModel = viewModel; }
public CameraFollowBehavior(MatchViewModel viewModel) { _viewModel = viewModel; }