Beispiel #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the CompetitorDivisions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCompetitorDivisions(CompetitorDivision competitorDivision)
 {
     base.AddObject("CompetitorDivisions", competitorDivision);
 }
        public ActionResult EditOlympicCompetitor(CompetitorDivision competitorDivision, List<CompetitorOlympicDivisionStep> OlympicDivisionSteps, List<CompetitorOlympicDivisionHyungBup> OlympicDivisionHyungBup)
        {
            Competitor competitor = db.Competitors.Single(m => m.CompetitorId == competitorDivision.CompetitorId);

            CompetitorDivision competitorDivisionToSave = competitor.CompetitorDivisions.Single(m => m.DivisionId == competitorDivision.DivisionId);
            competitorDivisionToSave.Judge1 = competitorDivision.Judge1;
            competitorDivisionToSave.Judge2 = competitorDivision.Judge2;
            competitorDivisionToSave.Judge3 = competitorDivision.Judge3;
            competitorDivisionToSave.Judge4 = competitorDivision.Judge4;
            competitorDivisionToSave.Judge5 = competitorDivision.Judge5;
            competitorDivisionToSave.TechnicalScore = competitorDivision.TechnicalScore;
            competitorDivisionToSave.HyungBupScore = competitorDivision.HyungBupScore;
            competitorDivisionToSave.TotalScore = competitorDivision.TotalScore;

            db.DeleteCompetitorOlympicSteps(competitorDivision.CompetitorId, competitorDivision.DivisionId);
            foreach (CompetitorOlympicDivisionStep olympicDivisionStep in OlympicDivisionSteps.Where(m => m.Total != 0))
            {
                competitor.CompetitorOlympicDivisionSteps.Add(olympicDivisionStep);
            }

            foreach (CompetitorOlympicDivisionHyungBup olympicDivisionHyungBup in OlympicDivisionHyungBup.Where(m => m.Total != 0))
            {
                competitor.CompetitorOlympicDivisionHyungBups.Add(olympicDivisionHyungBup);
            }

            db.ObjectStateManager.ChangeObjectState(competitor, EntityState.Modified);
            db.SaveChanges();

            return RedirectToAction("EditOlympic", new { id = competitor.TournamentId, divisionId = competitorDivision.DivisionId });

            /*TournamentDivision tournamentDivision = db.TournamentDivisions.Single(t => t.TournamentId == competitor.TournamentId && t.DivisionId == divisionId);
            InitViewBag(tournamentDivision);
            return View("EditOlympic", tournamentDivision);*/
        }
Beispiel #3
0
 /// <summary>
 /// Create a new CompetitorDivision object.
 /// </summary>
 /// <param name="competitorId">Initial value of the CompetitorId property.</param>
 /// <param name="divisionId">Initial value of the DivisionId property.</param>
 public static CompetitorDivision CreateCompetitorDivision(global::System.Int32 competitorId, global::System.Int32 divisionId)
 {
     CompetitorDivision competitorDivision = new CompetitorDivision();
     competitorDivision.CompetitorId = competitorId;
     competitorDivision.DivisionId = divisionId;
     return competitorDivision;
 }