/// <summary> /// Create a new Competitor object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="athleteId">Initial value of the AthleteId property.</param> /// <param name="eventClassId">Initial value of the EventClassId property.</param> /// <param name="deleted">Initial value of the Deleted property.</param> public static Competitor CreateCompetitor(global::System.Int64 id, global::System.Int64 athleteId, global::System.Int64 eventClassId, global::System.Boolean deleted) { Competitor competitor = new Competitor(); competitor.Id = id; competitor.AthleteId = athleteId; competitor.EventClassId = eventClassId; competitor.Deleted = deleted; return competitor; }
public void Save(Competitor competitor) { if (!_competitorStore.Contains(competitor)) { /*auto-increment field for competitorID did not seem to work with LinQ for Data Entity Model*/ long newid = 1; if ((from p in hardcardContext.Competitors select p.Id).Count() > 0) { newid = (from p in hardcardContext.Competitors select p.Id).Max() + 1; //EU CompetitorID->Id } competitor.Id = newid; hardcardContext.AddToCompetitors(competitor); hardcardContext.SaveChanges(); _competitorStore.Add(competitor); } else { hardcardContext.SaveChanges(); } }
/// <summary> /// Deprecated Method for adding a new object to the Competitors EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCompetitors(Competitor competitor) { base.AddObject("Competitors", competitor); }
public void Delete(Competitor competitor) { competitor.Deleted = true; hardcardContext.SaveChanges(); _competitorStore.Remove(competitor); }