public void Participer(int id) { Data._event ins = new Data._event(); Data.user uss = new Data.user(); IEnumerable <Data._event> eve = FindById(id); foreach (Data._event r in eve) { if (r.id_Ev == id) { ins = r; break; } break; } ins.capacity--; ins.nbPart++; ins.user_id = 1; ins.cat = Domain.Entity.category.cycleDeConferences; Update(ins); Commit(); }
public void SendEmail(Data.user user) { using (MailMessage mm = new MailMessage("*****@*****.**", user.email)) { mm.Subject = "Event details"; string body = "Hello " + user.username + ","; body += "<br /><br />You will be with us in this event"; body += "<br /><br />Thanks"; mm.Body = body; mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "esprit2018"); smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 587; smtp.Send(mm); } }