diff --git a/EzPay.WebApp/Controllers/CitizenController.cs b/EzPay.WebApp/Controllers/CitizenController.cs index e71e72d..449727e 100644 --- a/EzPay.WebApp/Controllers/CitizenController.cs +++ b/EzPay.WebApp/Controllers/CitizenController.cs @@ -148,12 +148,6 @@ public async Task ChangePassword() throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } - /*var hasPassword = await _userManager.HasPasswordAsync(user); - if (!hasPassword) - { - return RedirectToAction(nameof(SetPassword)); - }*/ - var model = new LoginViewModel { StatusMessage = CitizenStatusMessage }; return View(model); } diff --git a/EzPay.WebApp/Controllers/PaymentController.cs b/EzPay.WebApp/Controllers/PaymentController.cs index 5c06b09..de47afc 100644 --- a/EzPay.WebApp/Controllers/PaymentController.cs +++ b/EzPay.WebApp/Controllers/PaymentController.cs @@ -8,9 +8,11 @@ using Microsoft.AspNetCore.Identity; using EzPay.Model; using Microsoft.EntityFrameworkCore; +using Microsoft.AspNetCore.Authorization; namespace EzPay.WebApp.Controllers { + [Authorize] public class PaymentController : Controller { private readonly UserManager _userManager; @@ -46,8 +48,15 @@ public async Task Index(Guid id) return View(model); } - public IActionResult Pay(Guid id) + + public async Task Pay(Guid id) { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); + } + Payment payment = new Payment(); payment.BillId = id; payment.Date = DateTime.Now; diff --git a/EzPay.WebApp/Controllers/SettlementDetailsController.cs b/EzPay.WebApp/Controllers/SettlementDetailsController.cs index 2560c5d..21c9ec5 100644 --- a/EzPay.WebApp/Controllers/SettlementDetailsController.cs +++ b/EzPay.WebApp/Controllers/SettlementDetailsController.cs @@ -8,9 +8,11 @@ using Microsoft.AspNetCore.Identity; using EzPay.Model; using Microsoft.EntityFrameworkCore; +using Microsoft.AspNetCore.Authorization; namespace EzPay.WebApp.Controllers { + [Authorize] public class SettlementDetailsController : Controller { private readonly UserManager _userManager; @@ -39,23 +41,9 @@ public async Task Settle(LoginViewModel model) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } - //var model = new LoginViewModel - //{ - // CitizenId = user.Id, - // FirstName = user.FirstName, - // LastName = user.LastName, - // Address = user.Address, - // County = user.County, - // Email = user.Email, - // PhoneNumber = user.PhoneNumber, - // Bills = _ctx.GetSet().Where(c => c.CitizenId == user.Id) - // .Where(c => c.IsSelected == true) - // .Include(b => b.Settlement) - // .Include(b => b.Payment), - // Settlements = _ctx.GetSet().Where(c => c.CitizenId == user.Id) - // .Include(b => b.Bills), + model.SettlementTypes = _ctx.GetSet().AsQueryable(); - //}; + model.Bills = model.BillsList.Where(b => b.IsSelected == true); return View(model); } @@ -109,8 +97,14 @@ public async Task SubmitSettlement(LoginViewModel model) } [HttpGet] - public IActionResult BillsInSettlement(Guid id) + public async Task BillsInSettlement(Guid id) { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); + } + var model = new LoginViewModel { Bills = _ctx.GetSet().Where(c => c.SettlementId == id) diff --git a/EzPay.WebApp/Views/Payment/Index.cshtml b/EzPay.WebApp/Views/Payment/Index.cshtml index fcb1cd8..e092032 100644 --- a/EzPay.WebApp/Views/Payment/Index.cshtml +++ b/EzPay.WebApp/Views/Payment/Index.cshtml @@ -50,70 +50,78 @@
- -
+ +
- - + +
+
- -
-
- - +
+ +
+
+ + +
-
-
+ +
+
+ + +
+
-
-
- - Go Back
-
- + return result; + + + + } + @section Scripts { diff --git a/EzPay.WebApp/wwwroot/css/site.css b/EzPay.WebApp/wwwroot/css/site.css index 1c1c915..dbc8e15 100644 --- a/EzPay.WebApp/wwwroot/css/site.css +++ b/EzPay.WebApp/wwwroot/css/site.css @@ -1,6 +1,6 @@ body { padding-top: 60px; - padding-bottom: 60px; + padding-bottom: 80px; } .container { @@ -112,7 +112,9 @@ div .lc ul { } input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { +input[type=number]::-webkit-outer-spin-button, +input[type=month]::-webkit-inner-spin-button, +input[type=month]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } diff --git a/README.md b/README.md index 1754845..9ce3d42 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# .NET Coding School [![Build Status](https://travis-ci.com/akritikos/qualco.svg?token=mYyotAgYHz5qAPrDsB42&branch=master)](https://travis-ci.com/akritikos/qualco) +# .NET Coding School [![Build Status](https://travis-ci.org/akritikos/akritikos.github.io.svg?branch=master)](https://travis-ci.com/akritikos/qualco) ## Qualco Project (Team #2)