public void DeleteMatch(int id) { var entityToDelete = _matchRepository.GetById(id); _standingsRepository.EditStandings(entityToDelete); _matchRepository.Delete(entityToDelete); }
public ActionResult DeleteConfirmed(int id) { matchRepository.Delete(id); matchRepository.Save(); return(RedirectToAction("Index")); }
public IActionResult Delete(MatchDto user) { var model = _mapper.Map <MatchDto, Match>(user); _repository.Delete(model); return(new NoContentResult()); }
public Match Delete(int id) { var match = _matchRepository.FindById(id); _matchRepository.Delete(match); _dbContext.SaveChanges(); return(match); }
public ActionResult DeleteConfirmed(int id) { Match match = _matchRepository.FindById(id); _matchRepository.Delete(match); _matchRepository.Save(); return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteConfirmed(int id) { var match = await repository.FindsAsync(id); repository.Delete(match); await repository.SaveAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult> DeleteMatchAsync(int id) { var matchFromRepo = _matchRepo.GetById(id); if (matchFromRepo == null) { return(NotFound()); } _matchRepo.Delete(matchFromRepo); await _matchRepo.SaveChagesAsync(); return(NoContent()); }
public ActionResult <MatchDTO> DeleteMatch(int id) { MatchDTO match = _matchRepository.GetById(id); if (match == null) { return(NotFound()); } _matchRepository.Delete(match.MatchId); _matchRepository.SaveChanges(); return(match); }
public IActionResult Delete(int matchId) { Match match = matchRepository.Matches.FirstOrDefault(m => m.MatchID == matchId); try { match = matchRepository.Delete(match.MatchID); TempData["message"] = $"Match ID {match.MatchID} has been deleted"; } catch (Exception) { TempData["messageError"] = $"Match ID {match.MatchID} cannot be deleted because there is information associated."; } return(RedirectToAction("List")); }
public async Task DeleteMatchAsync(int id) { var matchToDel = await matchRepository.FindSingleAsync(x => x.MatchId == id) ?? throw new NotFoundInDatabaseException(); //TODO : TESTY if (matchToDel.BracketIndex != 0) { if (await IsMatchHavingAParentMatchInBracketAsync(matchToDel)) { throw new AmbiguousMatchException(); } } matchRepository.Delete(matchToDel); await unitOfWork.CompleteAsync(); }
public async Task <IActionResult> DeleteMatch(int id) { var match = await matchRepository.GetMatch(id); if (match == null) { return(BadRequest("Match does not exist.")); } matchRepository.Delete(match); if (await dataContext.Commit()) { return(Ok()); } return(BadRequest($"Could not delete match {id}")); }
public async Task GenerateScheduleAsync(GeneratorScheduleOutlines outlines) { var matches = await matchRepository.FindAsync(m => m.HomeTeam.TournamentId == outlines.TournamentId && m.GuestTeam.TournamentId == outlines.TournamentId); foreach (var match in matches) { matchRepository.Delete(match); } var possibleMatchDateTimes = await scheduleGeneratorManager.GetPossibleMatchDateTimesAsync(outlines); if (!possibleMatchDateTimes.Any()) { throw new ArgumentOutOfRangeException(); } var teams = await teamRepository.FindAsync(t => t.TournamentId == outlines.TournamentId); if (teams.Count < 2) { throw new NotFoundInDatabaseException(); } var matchDict = await scheduleGeneratorManager.GetPossibleMatchMatrix(teams.ToList()); var tournament = await tournamentRepository.FindSingleAsync(t => t.TournamentId == outlines.TournamentId); var generatedMatchesList = await scheduleGeneratorManager.GenerateSchedule(tournament.IsBracket, possibleMatchDateTimes, matchDict); generatedMatchesList.ForEach(gm => matchRepository.Add(gm)); await unitOfWork.CompleteAsync(); }
public void Delete(int id) { db.Delete(id); }
public void Delete(Match m) { _matchRepository.Delete(m); }
public async Task Delete(Match Match) { _Matchs.Delete(Match); await _Matchs.Save(); }