public static Int32 incrementLivret() { ContextParam ctx = new ContextParam(); Param oParam = ctx.dbParam.FirstOrDefault(); if (oParam == null) { oParam = new Param(); oParam.NumLivret = 0; ctx.dbParam.Add(oParam); } Int32 nReturn = oParam.NumLivret++; ctx.SaveChanges(); return(nReturn); }
public static Int32 incrementCandidat() { Int32 nReturn = 0; using (ContextParam ctxP = new ContextParam()) { Param oParam = ctxP.dbParam.FirstOrDefault(); if (oParam == null) { oParam = new Param(); oParam.NumLivret = 1; oParam.NumCandidat = 1; ctxP.dbParam.Add(oParam); } nReturn = oParam.NumCandidat++; ctxP.SaveChanges(); } return(nReturn); }