Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 709d848

Browse files
committed
Bug-Fix & Restructure
1 parent 4acf93a commit 709d848

File tree

9 files changed

+155
-211
lines changed

9 files changed

+155
-211
lines changed

README.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@
33
### KeyWords
44

55
1. ContactUs
6-
- Date
7-
- Name
8-
- Email
9-
- Message
6+
- ContactUsController
7+
- msg_context
8+
- ContactMsg
9+
10+
- Date
11+
- Name
12+
- Email
13+
- Message
1014

1115
2. Order
12-
- MemberId
13-
- ProductName
14-
- RequiredDate
15-
- Quantities
16+
- OrderController
17+
- order_context
18+
- u_o_Joint
19+
- MyOrder
20+
21+
- UserOrder
22+
23+
- MemberId
24+
- ProductName
25+
- RequiredDate
26+
- Quantities
1627

1728
3. SERVER_NAME
1829

@@ -27,10 +38,12 @@
2738
backend
2839
Controllers
2940
ContactUs
41+
ContactUsController
3042
Order
43+
OrderController
3144
Users
32-
Administration
33-
Authentication
45+
AdministrationController
46+
AuthenticationController
3447
Entities
3548
DataBaseContext
3649
Models
@@ -46,17 +59,21 @@ backend
4659
frontend
4760
Controllers
4861
ContactUs
62+
ContactUsController
4963
Miscellaneous
50-
Error
51-
Home
52-
Messages
64+
ErrorController
65+
HomeController
66+
MessagesController
5367
Order
68+
OrderController
5469
Users
55-
NewUser
56-
Users
70+
NewUserController
71+
UsersController
5772
Models
5873
ContactUs
5974
Order
75+
Order
76+
UserOrder
6077
Users
6178
JWT
6279
Users

backend/Controllers/Order/OrderController.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,51 @@ public string Post([FromBody] Order transaction)
3030
}
3131

3232

33-
// GET ORDERS
33+
// GET ALL
3434
[Authorize(Roles = "Admin")]
35-
[HttpGet("order")]
36-
public IEnumerable<UserOrder> GetOrder()
35+
[HttpGet("Order")]
36+
public IEnumerable<UserOrder> Get()
3737
{
38-
var usersOrder = from o in order_context.Set<Order>()
39-
join u in order_context.Set<Users>()
40-
on o.UserId equals u.UserId
41-
select new UserOrder
42-
{
43-
TransactionId = o.TransactionId,
38+
var u_o_Joint = from o in order_context.Set<Order>()
39+
join u in order_context.Set<Users>()
40+
on o.UserId equals u.UserId
41+
select new UserOrder
42+
{
43+
TransactionId = o.TransactionId,
4444

45-
MemberId = o.MemberId,
46-
ProductName = o.ProductName,
47-
RequiredDate = o.RequiredDate,
48-
Quantities = o.Quantities,
49-
UserId = o.UserId,
50-
FirstName = u.FirstName,
51-
LastName = u.LastName,
52-
Email = u.Email,
53-
};
54-
return usersOrder.ToList();
45+
MemberId = o.MemberId,
46+
ProductName = o.ProductName,
47+
RequiredDate = o.RequiredDate,
48+
Quantities = o.Quantities,
49+
UserId = o.UserId,
50+
FirstName = u.FirstName,
51+
LastName = u.LastName,
52+
Email = u.Email,
53+
};
54+
return u_o_Joint.ToList();
5555
}
5656

5757
[HttpGet("email/{email}")]
58-
public IEnumerable<UserOrder> GetOrderById(string email)
58+
public IEnumerable<UserOrder> GetById(string email)
5959
{
60-
var usersOrder = from o in order_context.Set<Order>()
61-
join u in order_context.Set<Users>()
62-
on o.UserId equals u.UserId
63-
select new UserOrder
64-
{
65-
TransactionId = o.TransactionId,
60+
var u_o_Joint = from o in order_context.Set<Order>()
61+
join u in order_context.Set<Users>()
62+
on o.UserId equals u.UserId
63+
select new UserOrder
64+
{
65+
TransactionId = o.TransactionId,
6666

67-
MemberId = o.MemberId,
68-
ProductName = o.ProductName,
69-
RequiredDate = o.RequiredDate,
70-
Quantities = o.Quantities,
67+
MemberId = o.MemberId,
68+
ProductName = o.ProductName,
69+
RequiredDate = o.RequiredDate,
70+
Quantities = o.Quantities,
7171

72-
UserId = o.UserId,
73-
FirstName = u.FirstName,
74-
LastName = u.LastName,
75-
Email = u.Email,
76-
};
77-
return usersOrder.ToList().Where(x => x.Email == email);
72+
UserId = o.UserId,
73+
FirstName = u.FirstName,
74+
LastName = u.LastName,
75+
Email = u.Email,
76+
};
77+
return u_o_Joint.ToList().Where(x => x.Email == email);
7878
}
7979

8080
}

backend/Entities/DataBaseContext.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2424
Email = "admin@localhost",
2525
Password = "Passcode1",
2626
Role = Roles.Admin
27+
},
28+
new Users
29+
{
30+
UserId = 2,
31+
Email = "member1@localhost",
32+
Password = "Passcode1",
33+
Role = Roles.Member
34+
},
35+
new Users
36+
{
37+
UserId = 3,
38+
Email = "member2@localhost",
39+
Password = "Passcode1",
40+
Role = Roles.Member
2741
}
2842
);
2943

@@ -43,11 +57,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4357
new Order
4458
{
4559
TransactionId = 1,
46-
MemberId = 1,
47-
ProductName = "Product",
60+
MemberId = 78125687,
61+
ProductName = "Sample ProductOne",
4862
RequiredDate = DateTime.Now,
4963
Quantities = 100,
50-
UserId = 1
64+
UserId = 2
65+
},
66+
new Order
67+
{
68+
TransactionId = 2,
69+
MemberId = 23458975,
70+
ProductName = "Sample ProductTwo",
71+
RequiredDate = DateTime.Now,
72+
Quantities = 150,
73+
UserId = 3
5174
});
5275
}
5376
}

backend/Models/Users/Roles.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace BackendAPI.Models
44
public class Roles
55
{
66
public const string Admin = "Admin";
7-
public const string Doctor = "Doctor";
87
public const string Member = "Member";
98
}
109
}

frontend/Controllers/Miscellaneous/HomeController.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,5 @@ public IActionResult Index()
1212
ViewBag.LogMessage = HttpContext.Session.GetString("UserName");
1313
return View();
1414
}
15-
16-
public IActionResult Team()
17-
{
18-
ViewBag.LogMessage = HttpContext.Session.GetString("UserName");
19-
return View();
20-
}
21-
2215
}
2316
}

frontend/Views/ContactUs/ContactUs.cshtml

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,48 @@
33
}
44
@model ContactUs
55

6-
<form asp-action="ContactUs" asp-controller="ContactUs" method="post" class="contactForm">
7-
<h1 class="headerText">ContactUs</h1>
8-
<div class="form-group">
9-
<input asp-for="Name" type="text" class="form-control" id="name" placeholder="Enter your name">
10-
</div>
11-
<div class="form-group">
12-
<input asp-for="Date" type="text" class="form-control" id="date" value=@DateTime.Today.ToString("d") hidden>
13-
</div>
14-
<div class="form-group">
15-
<input asp-for="Email" type="email" class="form-control" id="email" placeholder="Enter email">
16-
</div>
17-
<div class="form-group">
18-
<textarea asp-for="Message" class="form-control" id="message" rows="3"
6+
@if (@ViewBag.LogMessage != null)
7+
8+
{
9+
<form asp-action="ContactUs" asp-controller="ContactUs" method="post" class="contactForm">
10+
<h1 class="headerText">ContactUs</h1>
11+
<div class="form-group">
12+
<input asp-for="Name" type="text" class="form-control" id="name" placeholder="Enter your name">
13+
</div>
14+
<div class="form-group">
15+
<input asp-for="Date" type="text" class="form-control" id="date" value=@DateTime.Today.ToString("d") hidden>
16+
</div>
17+
<div class="form-group">
18+
<input asp-for="Email" type="email" class="form-control" id="email" placeholder="Enter email"
19+
value="@ViewBag.LogMessage">
20+
</div>
21+
<div class="form-group">
22+
<textarea asp-for="Message" class="form-control" id="message" rows="3"
23+
placeholder="Enter your message"></textarea>
24+
</div>
25+
<button type="submit" class="contactButton">Submit</button>
26+
</form>
27+
28+
}
29+
30+
else if (@ViewBag.LogMessage == null)
31+
32+
{
33+
<form asp-action="ContactUs" asp-controller="ContactUs" method="post" class="contactForm">
34+
<h1 class="headerText">ContactUs</h1>
35+
<div class="form-group">
36+
<input asp-for="Name" type="text" class="form-control" id="name" placeholder="Enter your name">
37+
</div>
38+
<div class="form-group">
39+
<input asp-for="Date" type="text" class="form-control" id="date" value=@DateTime.Today.ToString("d") hidden>
40+
</div>
41+
<div class="form-group">
42+
<input asp-for="Email" type="email" class="form-control" id="email" placeholder="Enter email">
43+
</div>
44+
<div class="form-group">
45+
<textarea asp-for="Message" class="form-control" id="message" rows="3"
1946
placeholder="Enter your message"></textarea>
20-
</div>
21-
<button type="submit" class="contactButton">Submit</button>
22-
</form>
47+
</div>
48+
<button type="submit" class="contactButton">Submit</button>
49+
</form>
50+
}

frontend/Views/Home/Index.cshtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
}
44

55

6-
</style>
7-
86
<div class="containerMod container1" style="display: block;">
97
<h1 class="head">Template</h1>
108
<h2 class="head">Using ASP.NET MVC, SQL Server, JWT</h2>
119
</div>
1210

1311

1412
<div class="footerLogo containerMod">
15-
<h5>Copyright © 2022, Hope Clinic. All rights reserved.</h5>
13+
<h5>Copyright © 2022, Template. All rights reserved.</h5>
1614
</div>

frontend/Views/Home/Team.cshtml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)