public async Task <IActionResult> PostStudent([FromBody] Student student) { try { var newStudent = await _studentsRepository.CreateStudent(student); return(OkJson(newStudent)); } catch (Exception e) { throw new Exception($"Exception when creating user {student.RitmLogin}", e); } }
public ActionResult Create([FromForm] StudentCreateViewModel model) { var student = StudentsRepository.CreateStudent(model.Student); return(RedirectToAction(nameof(Index))); }