public async Task <IActionResult> OnPostAsync(int?id) { Appointment = await _context.Appointment .Include(a => a.Client).FirstOrDefaultAsync(m => m.Id == id); EmailHandler smtp = new EmailHandler(); //Sends email with Appointment message await smtp.SendMailAsync(smtp.CreateAppointmentEmail(Appointment)); return(Page()); }