Skip to content
Snippets Groups Projects
Commit 222dbc5a authored by Rhys Nute's avatar Rhys Nute
Browse files

ready to merge

parent 9a7507d5
No related branches found
No related tags found
2 merge requests!38Draft: Businesses,!31Resolve "As a user, I want to see a page of local authorities so that I can easily source contact details for a variety of different local authorities."
......@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.stereotype.Controller;
import java.util.List;
@Controller
public class organisationControllers {
@GetMapping("/localauthorities")
......@@ -23,6 +25,7 @@ public class organisationControllers {
@GetMapping("/businesses")
public ModelAndView getBusinessPage(){
ModelAndView modelAndView = new ModelAndView("businesses");
List<business> business = businessRepository.getAllBusinesses();
modelAndView.addObject("busiSub", business);
return modelAndView;
}
......
......@@ -18,15 +18,15 @@ public class business {
@Override
public String toString(){
return "business{" +
businessName + '\'' +
address1 + '\'' +
address2 + '\'' +
city + '\'' +
county + '\'' +
postcode + '\'' +
return "Business:" + " " +
businessName + '\'' + " " +
address1 + '\'' + " " +
address2 + '\'' + " " +
city + '\'' + " " +
county + '\'' + " " +
postcode + '\'' + " " +
website +
'}';
" ";
}
public String getBusinessName() {
......
......@@ -5,6 +5,4 @@ import java.util.List;
public interface businessRepository {
List<business> getAllBusinesses();
void addBusiness(business bus);
void addLocalAuthority(business bus);
}
......@@ -27,21 +27,15 @@ public class businessRepositoryJDBC implements businessRepository{
);
}
public List<business> getAllBusinesses(){
String sql = "SELECT * FROM localAuthority";
String sql = "SELECT * FROM businesses";
return jdbc.query(sql, businessMapper);
}
@Override
public void addBusiness(business bus) {
}
@Override
public void addLocalAuthority(business bus){
String sql = "INSERT INTO business( businessName, address1, address2, city, county, postcode, website) values (?, ?, ?, ?, ?, ?, ?)";
String sql = "INSERT INTO businesses( businessName, address1, address2, city, county, postcode, website) values (?, ?, ?, ?, ?, ?, ?)";
jdbc.update(sql, bus.getBusinessName(),bus.getAddress1(),bus.getAddress2(),bus.getCity(),bus.getCounty(),bus.getPostcode(),bus.getWebsite());
}
}
}
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