public LigneScore(ScoreCard fk) { this.ScoreCard = fk; this.ScoreCardEvenementCentreCentreId = fk.EvenementCentreCentreId; this.ScoreCardEvenementEvenementId = fk.EvenementEvenementId; this.ScoreCard_dt = fk.dt; this.ScoreCard_pseudo = fk.pseudo; }
public bool AddScoreCard(ScoreCardEnveloppe enveloppe) { // connection bdd using (var context = new LQDMEntities()) { // on trouve le centre de rattachement Centre centre = context.Centre.Where(_ => _.CleExterne == enveloppe.CentreCle).FirstOrDefault(); if (centre == null) { // on essaye d'enregistrer une feuille sans identifier le centre return(false); } // on prends l'évenement (par défaut l'évenement Standard) Evenement e = context.Evenement.Where(_ => _.CentreCentreId == centre.CentreId && _.TypeEvenement == typeEvenement.Standard).FirstOrDefault(); LQModel.ScoreCard sc = new LQModel.ScoreCard(enveloppe.scoreCard, e); context.ScoreCard.Add(sc); context.SaveChanges(); } return(true); }
public JsonResult GetScoreCard(DateTime dt, string pseudo, string nomCentre) { if (string.IsNullOrEmpty(pseudo) || string.IsNullOrEmpty(nomCentre)) { return(null); } using (var context = new LQDMEntities()) { Centre centre = context.Centre.Where(_ => _.Nom.ToLower() == nomCentre.ToLower()).FirstOrDefault(); if (centre == null) { // on essaye d'enregistrer une feuille sans identifier le centre return(null); } LQModel.ScoreCard sc = context.ScoreCard.Where(_ => _.dt == dt && _.pseudo == pseudo && _.EvenementCentreCentreId == centre.CentreId).FirstOrDefault(); //string json = JsonConvert.SerializeObject(sc.ToScoreCardLight()); JsonResult jResult = new JsonResult(); jResult.Data = sc.ToScoreCardLight(); return(jResult); } }
public LigneScore(string equipe, string pseudo, typeLigneScore t, int front, int back, int gun, int shoulder, ScoreCard fk) { this.equipe = equipe; this.pseudoCible = pseudo; this.typeLigneScore = t; this.front = front; this.back = back; this.shoulder = shoulder; this.gun = gun; this.ScoreCard = fk; this.ScoreCardEvenementCentreCentreId = fk.EvenementCentreCentreId; this.ScoreCardEvenementEvenementId = fk.EvenementEvenementId; this.ScoreCard_dt = fk.dt; this.ScoreCard_pseudo = fk.pseudo; }