public void AddCallOrEmail(CallOrEmail c) { c.Date = DateTime.Now; var repo = new StudentsRepository(_connectionString); repo.AddCallOrEmail(c); }
public string SendEmail(int id) { var repo = new StudentsRepository(_connectionString); Student s = repo.GetStudentById(id); var result = repo.SendEmail(s.Email); if (result == "Mail has been successfully sent!") { CallOrEmail c = new CallOrEmail { StudentId = id, Type = CallOrEmailType.Email, Date = DateTime.Now, Notes = "sent automatic email" }; repo.AddCallOrEmail(c); } return(result); }