@RequestMapping( value = "/deleteBranch", method = {RequestMethod.GET, RequestMethod.POST}, consumes = "application/json") public List<Branch> deleteBranch(@RequestBody Branch branch) { branchdao.deleteBranch(branch); return branchdao.getAllBranches(1, 5); }
@RequestMapping( value = "/getBranchesCount", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json") public int getBranchesCount() { return branchdao.getBranchesCount(); }
@RequestMapping( value = "/editBranch", method = {RequestMethod.GET, RequestMethod.POST}, consumes = "application/json") public void editBranch(@RequestBody List<Branch> branches) { for (Branch branch : branches) branchdao.updateBranch(branch); }
/*Admin Branch*/ @RequestMapping( value = "/getBranches/{pageNo}/{pageSize}", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json") public List<Branch> getBranches(@PathVariable int pageNo, @PathVariable int pageSize) { return branchdao.getAllBranches(pageNo, pageSize); }
/*Borrower*/ @RequestMapping( value = "/getBooksByBranch", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json", consumes = "application/json") public List<Book> getBooksByBranch(@RequestBody Branch branch) { Branch b = branchdao.getBranchById(branch.getBranchId()); return b.getBooks(); }