Search in sources :

Example 1 with Theme

use of br.fatecsp.engsoft.entities.Theme in project Projeto_Detetive_ES3 by VitorAndrioli.

the class CardService method register.

public Card register(Long themeId, CardRequest request) {
    Card card = Card.toEntity(request);
    Theme theme = themeService.find(themeId);
    card.setTheme(theme);
    return cardRepository.save(card);
}
Also used : Theme(br.fatecsp.engsoft.entities.Theme) Card(br.fatecsp.engsoft.entities.Card)

Example 2 with Theme

use of br.fatecsp.engsoft.entities.Theme in project Projeto_Detetive_ES3 by VitorAndrioli.

the class ThemeService method register.

public Theme register(ThemeRequest request) {
    Theme theme = Theme.toEntity(request);
    themeRepository.save(theme);
    return theme;
}
Also used : Theme(br.fatecsp.engsoft.entities.Theme)

Example 3 with Theme

use of br.fatecsp.engsoft.entities.Theme in project Projeto_Detetive_ES3 by VitorAndrioli.

the class ThemeService method update.

public Theme update(Long id, ThemeRequest request) {
    Theme theme = themeRepository.findOne(id);
    theme.setName(request.getName());
    theme.setPrice(request.getPrice());
    theme.setImageSrc(request.getImageSrc());
    themeRepository.save(theme);
    return theme;
}
Also used : Theme(br.fatecsp.engsoft.entities.Theme)

Example 4 with Theme

use of br.fatecsp.engsoft.entities.Theme in project Projeto_Detetive_ES3 by VitorAndrioli.

the class ThemeController method listAll.

@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("hasAuthority('ADMIN')")
public ModelAndView listAll() {
    ModelAndView model = new ModelAndView("themes");
    List<Theme> themes = themeService.findAll();
    model.addObject("themes", themes);
    return model;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) Theme(br.fatecsp.engsoft.entities.Theme) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

Theme (br.fatecsp.engsoft.entities.Theme)4 Card (br.fatecsp.engsoft.entities.Card)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1