public ActionResult Put(int id, [FromBody] StudentDto value) { var result = _studentService.UpdateStudent(value.ToModel()); if (result.HasErrors) { return(BadRequest(result.Errors)); } return(Accepted()); }
public ActionResult <StudentDto> Post([FromBody] StudentDto student) { var result = _studentService.CreateStudent(student.ToModel()); if (result.HasErrors) { return(BadRequest(result.Errors)); } return(Accepted(StudentDto.FromModel(result.Result))); }
public ActionResult Put(int id, [FromBody] StudentDto value) { _studentService.UpdateStudent(value.ToModel()); return(Accepted()); }
public ActionResult <StudentDto> Post([FromBody] StudentDto student) { var createdStudent = _studentService.CreateStudent(student.ToModel()); return(Accepted(StudentDto.FromModel(createdStudent))); }