private void detach_GroupSign(GroupSign entity) { this.SendPropertyChanging(); entity.Profil = null; }
private void attach_GroupSign(GroupSign entity) { this.SendPropertyChanging(); entity.Profil = this; }
partial void DeleteGroupSign(GroupSign instance);
partial void UpdateGroupSign(GroupSign instance);
partial void InsertGroupSign(GroupSign instance);
public bool CreateOrUpdateGroupSign(int eventId, int profilId, int score) { using (MasterDBDataContext db = new MasterDBDataContext()) { Event eventGame = db.Event.SingleOrDefault(e => e.idEvent == eventId); Profil profil = db.Profil.SingleOrDefault(p => p.idProfil == profilId); if (eventGame != null && profil != null) { GroupSign groupSign = null; groupSign = db.GroupSign.SingleOrDefault(gs => gs.idEvent == eventId && gs.idProfil == profilId); if (groupSign == null) { groupSign = new GroupSign() { idEvent = eventId, idProfil = profil.idProfil, Score = score }; db.GroupSign.InsertOnSubmit(groupSign); } else { if (groupSign.Score < score) { groupSign.Score = score; } } try { db.SubmitChanges(); } catch (Exception ex) { Console.WriteLine("Create Group Sign " + ex.Message); return false; } } } return true; }