Skip to content
Snippets Groups Projects
Commit 781f7ad4 authored by Stefan Kannamüller's avatar Stefan Kannamüller
Browse files
parent c236c795
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,12 @@ public class BuchungController {
return mv;
}
@RequestMapping(value="/stornieren", method=RequestMethod.GET)
public ModelAndView stornieren() {
ModelAndView mv = new ModelAndView();
mv.setViewName("stornieren");
return mv;
}
@RequestMapping(value="/save2", method=RequestMethod.GET)
......@@ -86,10 +92,11 @@ public class BuchungController {
return mv;
}
@RequestMapping(value="/delete", method=RequestMethod.GET)
public ModelAndView delete(@RequestParam(required=true) Long buchungid) {
buchungService.delete(buchungid);
return new ModelAndView("home");
}
}
package de.thd.pms.service;
import java.sql.Date;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
......@@ -48,6 +49,11 @@ public class BuchungService {
return buchung;
}
public void delete(Long buchungid) {
Buchung b = buchungRepository.findById(buchungid).get();
buchungRepository.delete(b);
}
/*public void beginne (Long id, Long zimmerid, Date[] belegtvon, Date[] belegtbis, Long[] erwa_anz, Long[] kind_anz) {
Zimmer b = zimmerRepository.findById(zimmerid).get();
......
......@@ -5,4 +5,4 @@ spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.initialization-mode=always
spring.datasource.data=classpath:data-zimmer.sql
#server.port=1234
\ No newline at end of file
server.port=1234
\ No newline at end of file
......@@ -27,7 +27,7 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Buchung<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a th:href="@{~/kunde/edit}">Buchung</a></li>
<li><a th:href="@{~/buchung/stornieren}">Buchung stornieren</a></li>
</ul>
</li>
......
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="head::head"></head>
<body>
<nav th:include="menu::menu"></nav>
<form method="GET" >
<p>Buchung stornieren</p>
<p>
<label for="Buchungsbestätigungsnummer">Buchungsbestätigungsnummer:</label>
<input type="text" name="Buchungsbestätigungsnummer" id="Buchungsbestätigungsnummer" size="25">
</p>
<a th:href="@{/buchung/delete(buchungid=${Buchungsbestätigungsnummer})}" class="btn btn-primary mt-5">stornieren</a>
</form>
<div th:include="foot::foot"></div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment