public bool AddAnnounce(Annonce pAnnounce) { try { context.AddOrUpdate <Annonce>(pAnnounce); return(true); } catch (Exception ex) { HCK_TOOLS.Log.WriteLog(ex); return(false); } }
public bool Register(string pLogin, string pPassword, string pPrenom, string pNom, DateTime pDateNaissance) { try { if (String.IsNullOrEmpty(pPrenom)) { throw new Exception("Veuillez renseigner un prénom"); } if (pDateNaissance == null) { throw new Exception("Veuillez renseigner une date de naissance"); } context.AddOrUpdate(new Profil() { prenom = pPrenom, nom = pNom, dateDeNaissance = pDateNaissance }, p => p.idProfil); context.AddOrUpdate(new Utilisateur() { motDePasse = pPassword, adresseMail = pLogin, idProfil = context.GetAll <Profil>().Max(p => p.idProfil) }); } catch (Exception ex) { Log.WriteLog(ex); return(false); } return(true); }