Search in sources :

Example 1 with SampleClassDto

use of uk.ac.bbsrc.tgac.miso.dto.SampleClassDto in project miso-lims by miso-lims.

the class SampleClassRestController method updateSampleClass.

@PutMapping(value = "/{id}", headers = { "Content-type=application/json" })
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public SampleClassDto updateSampleClass(@PathVariable("id") long id, @RequestBody SampleClassDto sampleClassDto) throws IOException {
    return RestUtils.updateObject("Sample Class", id, sampleClassDto, Dtos::to, sampleClassService, sampleClass -> {
        SampleClassDto dto = Dtos.asDto(sampleClass);
        constantsController.refreshConstants();
        return dto;
    });
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) SampleClassDto(uk.ac.bbsrc.tgac.miso.dto.SampleClassDto) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PutMapping(org.springframework.web.bind.annotation.PutMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with SampleClassDto

use of uk.ac.bbsrc.tgac.miso.dto.SampleClassDto in project miso-lims by miso-lims.

the class SampleClassRestController method createSampleClass.

@PostMapping(headers = { "Content-type=application/json" })
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public SampleClassDto createSampleClass(@RequestBody SampleClassDto sampleClassDto) throws IOException {
    return RestUtils.createObject("Sample Class", sampleClassDto, Dtos::to, sampleClassService, sampleClass -> {
        SampleClassDto dto = Dtos.asDto(sampleClass);
        constantsController.refreshConstants();
        return dto;
    });
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) SampleClassDto(uk.ac.bbsrc.tgac.miso.dto.SampleClassDto) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)2 Dtos (uk.ac.bbsrc.tgac.miso.dto.Dtos)2 SampleClassDto (uk.ac.bbsrc.tgac.miso.dto.SampleClassDto)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 PutMapping (org.springframework.web.bind.annotation.PutMapping)1