public AccountModel GetAccountForId(int id) { AccountModel account = new AccountModel(); Mapping mapping = new Mapping(); Account accountDB = accountRepository.GetOne(id); if (accountDB != null) { mapping.MapObjects(accountDB, account); } return(account); }
public int AcceptRegistration(int id, bool reply) { var signer = projectRepository.AcceptRegistration(id, reply); var account = accoutM.GetOne(signer.Account); var title = projectRepository.GetOne(signer.Project).Title; MailMessage message = new MailMessage(); message.To.Add(account.Email); message.Subject = "Iscrizione Progetto " + title; message.IsBodyHtml = true; message.Body = "La tua richiesta di iscrizione al progetto " + title + " รจ stata: "; if (reply) { message.Body += "Confermata"; } else { message.Body += "Rifiutata"; } var systemEmail = configSystenm.GetOne("EmailSystem"); var systemEmailPass = configSystenm.GetOne("PassEmail"); message.From = new MailAddress("*****@*****.**", "Iscrizione: " + title); SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(systemEmail, systemEmailPass); smtp.Send(message); return(signer.Project); }