use of br.fatecsp.engsoft.domain.CardRequest in project Projeto_Detetive_ES3 by VitorAndrioli.
the class DeckController method update.
@PostMapping(value = "/card/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
public ModelAndView update(@PathVariable("id") Long id, @RequestParam("photo") MultipartFile photoFile, @RequestParam("name") String name, @RequestParam("type") String type) {
String cardSrc = "";
try {
if (photoFile.getBytes().length != 0) {
cardSrc = photosFile.createFile(photoFile);
} else {
cardSrc = cardService.getById(id).getCardSrc();
}
} catch (IOException e) {
e.printStackTrace();
}
CardRequest cardRequest = new CardRequest(name, type, cardSrc);
Long themeId = (Long) session.getAttribute("theme");
cardService.update(id, cardRequest);
return listAll(themeId);
}
use of br.fatecsp.engsoft.domain.CardRequest in project Projeto_Detetive_ES3 by VitorAndrioli.
the class DeckController method register.
@PostMapping(value = "/card", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
public ModelAndView register(@RequestParam("photo") MultipartFile photoFile, @RequestParam("name") String name, @RequestParam("type") String type) {
String cardSrc = photosFile.createFile(photoFile);
CardRequest cardRequest = new CardRequest(name, type, cardSrc);
Long themeId = (Long) session.getAttribute("theme");
cardService.register(themeId, cardRequest);
return listAll(themeId);
}
Aggregations