예제 #1
0
        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)));
        }