Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team 5 - Smart Towns
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rhys Evans
Team 5 - Smart Towns
Merge requests
!38
Draft: Businesses
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Draft: Businesses
businesses
into
main
Overview
2
Commits
54
Pipelines
0
Changes
18
Merged
Rhys Nute
requested to merge
businesses
into
main
1 year ago
Overview
2
Commits
54
Pipelines
0
Changes
18
Expand
0
0
Merge request reports
Compare
main
version 16
f4f01663
1 year ago
version 15
bf327e53
1 year ago
version 14
7467df3b
1 year ago
version 13
02cc91de
1 year ago
version 12
19ca6aeb
1 year ago
version 11
ad6fc3e2
1 year ago
version 10
09e5ec77
1 year ago
version 9
222dbc5a
1 year ago
version 8
9a7507d5
1 year ago
version 7
9bb8a0a6
1 year ago
version 6
133b3d67
1 year ago
version 5
0ca292ec
1 year ago
version 4
91f45878
1 year ago
version 3
5e18506a
1 year ago
version 2
62cf05fc
1 year ago
version 1
94253d55
1 year ago
main (base)
and
latest version
latest version
6ecf6e86
54 commits,
1 year ago
version 16
f4f01663
53 commits,
1 year ago
version 15
bf327e53
52 commits,
1 year ago
version 14
7467df3b
51 commits,
1 year ago
version 13
02cc91de
50 commits,
1 year ago
version 12
19ca6aeb
49 commits,
1 year ago
version 11
ad6fc3e2
45 commits,
1 year ago
version 10
09e5ec77
19 commits,
1 year ago
version 9
222dbc5a
18 commits,
1 year ago
version 8
9a7507d5
17 commits,
1 year ago
version 7
9bb8a0a6
16 commits,
1 year ago
version 6
133b3d67
15 commits,
1 year ago
version 5
0ca292ec
14 commits,
1 year ago
version 4
91f45878
13 commits,
1 year ago
version 3
5e18506a
12 commits,
1 year ago
version 2
62cf05fc
11 commits,
1 year ago
version 1
94253d55
10 commits,
1 year ago
18 files
+
589
−
141
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
18
Search (e.g. *.vue) (Ctrl+P)
src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java
0 → 100644
+
64
−
0
Options
package
Team5.SmartTowns.Organisation
;
import
Team5.SmartTowns.business.business
;
import
Team5.SmartTowns.business.businessRepository
;
import
jakarta.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.stereotype.Controller
;
import
java.util.List
;
@Controller
public
class
organisationControllers
{
@GetMapping
(
"/localauthorities"
)
public
ModelAndView
getLocalAuthoritiesPage
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"local-authorities"
);
return
modelAndView
;
}
@GetMapping
(
"/businesses"
)
public
ModelAndView
getBusinessPage
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"businesses"
);
List
<
business
>
business
=
businessRepository
.
getAllBusinesses
();
modelAndView
.
addObject
(
"busiSub"
,
business
);
return
modelAndView
;
}
@GetMapping
(
"/businessSub"
)
public
ModelAndView
getBusinessSubPage
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"business-data"
);
modelAndView
.
addObject
(
"business"
,
new
business
());
return
modelAndView
;
}
@Autowired
private
businessRepository
businessRepository
;
@PostMapping
(
"/business-data"
)
public
ModelAndView
businessSent
(
@Valid
@ModelAttribute
(
"business-data"
)
business
business
,
BindingResult
bindingResult
,
Model
model
)
{
if
(
bindingResult
.
hasErrors
())
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"business-data"
,
model
.
asMap
());
return
modelAndView
;
}
else
{
// converts user input using the organisation constructor into a submittable format to the sql table
business
bus
=
new
business
(
business
.
getBusinessName
(),
business
.
getAddress1
(),
business
.
getAddress2
(),
business
.
getCity
(),
business
.
getCounty
(),
business
.
getPostcode
(),
business
.
getWebsite
());
System
.
out
.
println
(
bus
);
businessRepository
.
addBusiness
(
bus
);
//add local authority to local authority table
ModelAndView
modelAndView
=
new
ModelAndView
(
"redirect:/businesses"
);
return
modelAndView
;
}
}
@GetMapping
(
"/consumers"
)
public
ModelAndView
getConsumersPage
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"WorkWith/consumers.html"
);
return
modelAndView
;
}
@GetMapping
(
"/towns"
)
public
ModelAndView
getTownsPage
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"WorkWith/towns.html"
);
return
modelAndView
;
}
}
Loading