FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PythonMvcMySQL/BookController.py at master · iandygit/PythonMvcMySQL · GitHub
iandygit
PythonMvcMySQL
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
PythonMvcMySQL
/
BookController.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (40 loc) · 1.26 KB
Breadcrumbs
PythonMvcMySQL
/
BookController.py
Copy path
File metadata and controls
49 lines (40 loc) · 1.26 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 *-*
__author__
=
'Gonzalo Chacaltana Buleje'
from
Book
import
Book
from
BookView
import
BookView
import
sys
class
BookController
:
def
__init__
(
self
):
self
.
view
=
BookView
()
self
.
book_main_controller
()
def
book_main_controller
(
self
):
"""main method controller"""
request
=
self
.
view
.
show_main
()
self
.
request
=
int
(
request
)
if
self
.
request
==
1
:
self
.
create_book
()
elif
self
.
request
==
2
:
self
.
list_books
()
elif
self
.
request
==
3
:
self
.
edit_book
()
elif
self
.
request
==
4
:
self
.
delete_book
()
def
create_book
(
self
):
"""create book"""
(
category
,
title
,
price
)
=
self
.
view
.
create_book
()
objBook
=
Book
()
objBook
.
id_category
=
category
objBook
.
title
=
title
objBook
.
price
=
price
objBook
.
create
()
self
.
view
.
show_message_created
()
self
.
book_main_controller
()
def
list_books
(
self
):
list
=
self
.
getBooks
()
self
.
view
.
list_books
(
list
)
self
.
book_main_controller
()
def
getBooks
(
self
):
book
=
Book
()
books
=
book
.
read_all
()
return
books
controller
=
BookController
()
Back
|
FazBrowse Home
|
New Git URL