|
|
|
@ -22,7 +22,6 @@ import static org.springframework.util.StringUtils.isEmpty;
|
|
|
|
|
import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE;
|
|
|
|
|
import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE;
|
|
|
|
|
import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
|
|
|
|
import static ru.ulstu.core.controller.Navigation.hasErrors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller()
|
|
|
|
@ -56,7 +55,8 @@ public class ConferenceController {
|
|
|
|
|
if (conferenceDto.getDeadlines().isEmpty()) {
|
|
|
|
|
errors.rejectValue("deadlines", "errorCode", "Не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
hasErrors(errors, CONFERENCE_PAGE);
|
|
|
|
|
if (errors.hasErrors())
|
|
|
|
|
return CONFERENCE_PAGE;
|
|
|
|
|
conferenceService.save(conferenceDto);
|
|
|
|
|
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
|
|
|
|
|
|
|
|
@ -65,7 +65,8 @@ public class ConferenceController {
|
|
|
|
|
@PostMapping(value = "/conference", params = "addDeadline")
|
|
|
|
|
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
|
|
|
|
filterEmptyDeadlines(conferenceDto);
|
|
|
|
|
hasErrors(errors, CONFERENCE_PAGE);
|
|
|
|
|
if (errors.hasErrors())
|
|
|
|
|
return CONFERENCE_PAGE;
|
|
|
|
|
conferenceDto.getDeadlines().add(new Deadline());
|
|
|
|
|
return CONFERENCE_PAGE;
|
|
|
|
|
}
|
|
|
|
|