示例#1
0
        public async Task <IActionResult> Create([Bind("StudentId,Name,Mail,Phone,GitHubHomeUrl,GoogleAccount")] Student student)
        {
            if (ModelState.IsValid)
            {
                var logMessage = $"Student name: {student.Name}, Mail: {student.Mail}, Phone: {student.Phone}, GitHubUrl: {student.GitHubHomeUrl}, GoogleAccount: {student.GoogleAccount}";
                _logger.LogInformation(logMessage);
                _emailSender.LogToOutput(logMessage);
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }