public async Task <IActionResult> Create([FromBody] StudentViewModel student) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Student newStudent = new Student { LastName = student.LastName, FirstMidName = student.FirstMidName, EnrollmentDate = student.EnrollmentDate }; await _studentsRepository.AddAsync(newStudent); await _studentsRepository.CommitAsync(); student = Mapper.Map <Student, StudentViewModel>(newStudent); return(CreatedAtRoute("GetStudent", new { controller = "Students", id = student.ID }, student)); }