From d5a1b3f1af2a30b1c82cba9958ff54c0033e843e Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 17 Jul 2025 19:13:12 +0800 Subject: [PATCH 1/5] feat: Implement Order Status filtering --- .../Admin/Controllers/OrderController.cs | 35 ++++- .../Areas/Admin/Views/Order/Details.cshtml | 143 ++++++++++++++++++ .../Areas/Admin/Views/Order/Index.cshtml | 40 ++++- TeaTimeDemo/wwwroot/js/order.js | 23 ++- 4 files changed, 230 insertions(+), 11 deletions(-) create mode 100644 TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml diff --git a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs index 97e0bda..f74ef21 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs @@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Mvc; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.ViewModels; +using TeaTimeDemo.Utility; namespace TeaTimeDemo.Areas.Admin.Controllers { @@ -19,11 +21,40 @@ namespace TeaTimeDemo.Areas.Admin.Controllers { return View(); } + + public IActionResult Details(int orderId) + { + OrderVM orderVM = new OrderVM + { + // 根據訂單標題內的訂購人 id,顯示訂購人的資訊,以及顯示訂單內所有產品的內容 + OrderHeader = _unitOfWork.OrderHeader.Get(u => u.Id == orderId, includeProperties: nameof(ApplicationUser)), + OrderDetail = _unitOfWork.OrderDetail.GetAll(u => u.OrderHeaderId == orderId, includeProperties: nameof(Product)) + }; + return View(orderVM); + } + #region API CALLS - public IActionResult GetAll() + public IActionResult GetAll(string status) { + IEnumerable objOrderHeaders = _unitOfWork.OrderHeader.GetAll(includeProperties: nameof(ApplicationUser)).ToList(); // 取得所有訂單資訊,並包含訂購人 - List objOrderHeaders = _unitOfWork.OrderHeader.GetAll(includeProperties: nameof(ApplicationUser)).ToList(); + switch (status) + { + case "Pending": + objOrderHeaders = objOrderHeaders.Where(u => u.OrderStatus == SD.StatusPending); + break; + case "Processing": + objOrderHeaders = objOrderHeaders.Where(u => u.OrderStatus == SD.StatusInProcess); + break; + case "Ready": + objOrderHeaders = objOrderHeaders.Where(u => u.OrderStatus == SD.StatusReady); + break; + case "Completed": + objOrderHeaders = objOrderHeaders.Where(u => u.OrderStatus == SD.StatusCompleted); + break; + default: + break; + } return Json(new { data = objOrderHeaders }); } #endregion diff --git a/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml b/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml new file mode 100644 index 0000000..077b4bf --- /dev/null +++ b/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml @@ -0,0 +1,143 @@ +@model OrderVM +@using TeaTimeDemo.Utility + +
+ +
+
+
+
+
+
+   訂單總計 Order Summary +
+ +
+
+
+
+
+
+
+

+ 訂購人資訊 PickUp Details: +

+
+
+
姓名 Name
+
+ @if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + + + } + else + { + + } +
+
+
+
手機 Phone
+
+ @if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + + + } + else + { + + } +
+
+
+
地址 Address
+
+ @if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + + + } + else + { + + } +
+
+ +
+
信箱 Email
+
+ +
+
+
+
訂購日期 Order Date
+
+ +
+
+ @if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + + } +
+
+

+ 訂購內容 Order Summary +

+ + +
    + @foreach (var detail in Model.OrderDetail) + { +
  • +
    +
    + +
    @detail.Product.Name
    + 價格:@detail.Price.ToString("c")
    + 數量:@detail.Count
    + 甜度:@detail.sweetness
    + 冰塊:@detail.Ice +
    +
    +

    @((detail.Count * detail.Price).ToString("c"))

    +
    +
    +
  • + } +
  • +
    +
    +
    總計 TOTAL
    +
    +
    +
    @Model.OrderHeader.OrderTotal.ToString("c")
    +
    +
    +
  • +
+ + + + + +
+
+
+
+
+
+
+ +@section Scripts { + + + +} \ No newline at end of file diff --git a/TeaTimeDemo/Areas/Admin/Views/Order/Index.cshtml b/TeaTimeDemo/Areas/Admin/Views/Order/Index.cshtml index 5260e7c..8754fab 100644 --- a/TeaTimeDemo/Areas/Admin/Views/Order/Index.cshtml +++ b/TeaTimeDemo/Areas/Admin/Views/Order/Index.cshtml @@ -1,4 +1,32 @@ -
+@{ + var status = Context.Request.Query["status"]; + var pending = "text-primary"; + var processing = "text-primary"; + var ready = "text-primary"; + var completed = "text-primary"; + var all = "text-primary"; + + switch(status) + { + case "Pending": + pending = "active text-white"; + break; + case "Processing": + processing = "active text-white"; + break; + case "Ready": + ready = "active text-white"; + break; + case "Completed": + completed = "active text-white"; + break; + default: + pending = "active text-white"; + break; + } +} + +
diff --git a/TeaTimeDemo/wwwroot/js/order.js b/TeaTimeDemo/wwwroot/js/order.js index 168fba9..19dc2f6 100644 --- a/TeaTimeDemo/wwwroot/js/order.js +++ b/TeaTimeDemo/wwwroot/js/order.js @@ -1,12 +1,29 @@ var dataTable; $(document).ready(function () { - loadDataTable(); + var url = window.location.search; + switch (true) { + case url.includes("Processing"): + loadDataTable("Processing"); + break; + case url.includes("Pending"): + loadDataTable("Pending"); + break; + case url.includes("Ready"): + loadDataTable("Ready"); + break; + case url.includes("Completed"): + loadDataTable("Completed"); + break; + default: + loadDataTable("all"); + break; + } }); -function loadDataTable() { +function loadDataTable(status) { dataTable = $('#tblData').DataTable({ "ajax": { - url: '/admin/order/getall' + url: '/admin/order/getall?status=' + status }, "columns": [ { data: 'id', "width": "10%" }, -- GitLab From d35a7358eab9a1e76f77d9f44c448a86dd253270 Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 17 Jul 2025 19:45:13 +0800 Subject: [PATCH 2/5] feat: let Admin, Manager, Employee can edit info about the order person. --- .../Admin/Controllers/OrderController.cs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs index f74ef21..528814d 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs @@ -12,6 +12,8 @@ namespace TeaTimeDemo.Areas.Admin.Controllers public class OrderController : Controller { private readonly IUnitOfWork _unitOfWork; + [BindProperty] + public OrderVM OrderVM { get; set; } public OrderController(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; @@ -24,13 +26,30 @@ namespace TeaTimeDemo.Areas.Admin.Controllers public IActionResult Details(int orderId) { - OrderVM orderVM = new OrderVM + OrderVM = new OrderVM { // 根據訂單標題內的訂購人 id,顯示訂購人的資訊,以及顯示訂單內所有產品的內容 OrderHeader = _unitOfWork.OrderHeader.Get(u => u.Id == orderId, includeProperties: nameof(ApplicationUser)), OrderDetail = _unitOfWork.OrderDetail.GetAll(u => u.OrderHeaderId == orderId, includeProperties: nameof(Product)) }; - return View(orderVM); + return View(OrderVM); + } + + [HttpPost] + [Authorize(Roles = SD.Role_Admin + "," + SD.Role_Employee + "," + SD.Role_Manager)] + public IActionResult UpdateOrderDetail() + { + var orderHeaderFromDb = _unitOfWork.OrderHeader.Get(u => u.Id == OrderVM.OrderHeader.Id); + orderHeaderFromDb.Name = OrderVM.OrderHeader.Name; + orderHeaderFromDb.PhoneNumber = OrderVM.OrderHeader.PhoneNumber; + orderHeaderFromDb.Address = OrderVM.OrderHeader.Address; + + _unitOfWork.OrderHeader.Update(orderHeaderFromDb); + _unitOfWork.Save(); + + TempData["Success"] = "訂購人資訊更新成功!!"; + + return RedirectToAction(nameof(Details), new { orderId = orderHeaderFromDb.Id }); } #region API CALLS -- GitLab From 717556fadcfd0244e304c09fd9e7940f48a4354c Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 17 Jul 2025 20:30:59 +0800 Subject: [PATCH 3/5] feat: Implement Status Controlling for Admin-like users. --- .../Admin/Controllers/OrderController.cs | 63 ++++++++++++++++++- .../Areas/Admin/Views/Order/Details.cshtml | 23 +++++-- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs index 528814d..d03ccd5 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/OrderController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using System.Security.Claims; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; using TeaTimeDemo.Models.ViewModels; @@ -52,10 +53,70 @@ namespace TeaTimeDemo.Areas.Admin.Controllers return RedirectToAction(nameof(Details), new { orderId = orderHeaderFromDb.Id }); } + [HttpPost] + [Authorize(Roles = SD.Role_Admin + "," + SD.Role_Employee + "," + SD.Role_Manager)] + public IActionResult StartProcessing() + { + _unitOfWork.OrderHeader.UpdateStatus(OrderVM.OrderHeader.Id, SD.StatusInProcess); + _unitOfWork.Save(); + + TempData["Success"] = "訂單狀態更新成功!"; + + return RedirectToAction(nameof(Details), new { orderId = OrderVM.OrderHeader.Id }); + } + + [HttpPost] + [Authorize(Roles = SD.Role_Admin + "," + SD.Role_Employee + "," + SD.Role_Manager)] + public IActionResult OrderReady() + { + _unitOfWork.OrderHeader.UpdateStatus(OrderVM.OrderHeader.Id, SD.StatusReady); + _unitOfWork.Save(); + + TempData["Success"] = "訂單狀態更新成功!"; + + return RedirectToAction(nameof(Details), new { orderId = OrderVM.OrderHeader.Id }); + } + + [HttpPost] + [Authorize(Roles = SD.Role_Admin + "," + SD.Role_Employee + "," + SD.Role_Manager)] + public IActionResult OrderCompleted() + { + _unitOfWork.OrderHeader.UpdateStatus(OrderVM.OrderHeader.Id, SD.StatusCompleted); + _unitOfWork.Save(); + + TempData["Success"] = "訂單狀態更新成功!"; + + return RedirectToAction(nameof(Details), new { orderId = OrderVM.OrderHeader.Id }); + } + + [HttpPost] + [Authorize(Roles = SD.Role_Admin + "," + SD.Role_Employee + "," + SD.Role_Manager)] + public IActionResult CancelOrder() + { + _unitOfWork.OrderHeader.UpdateStatus(OrderVM.OrderHeader.Id, SD.StatusCancelled); + _unitOfWork.Save(); + + TempData["Success"] = "訂單取消成功!"; + + return RedirectToAction(nameof(Details), new { orderId = OrderVM.OrderHeader.Id }); + } + #region API CALLS public IActionResult GetAll(string status) { - IEnumerable objOrderHeaders = _unitOfWork.OrderHeader.GetAll(includeProperties: nameof(ApplicationUser)).ToList(); + IEnumerable objOrderHeaders; + + if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + objOrderHeaders = _unitOfWork.OrderHeader.GetAll(includeProperties: nameof(ApplicationUser)).ToList(); + } + else + { + var claimsIdentity = (ClaimsIdentity)User.Identity; + var userId = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier).Value; + objOrderHeaders = _unitOfWork.OrderHeader.GetAll(u => u.ApplicationUserId == userId, includeProperties: nameof(ApplicationUser)); + } + // 取得所有訂單資訊,並包含訂購人 switch (status) { diff --git a/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml b/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml index 077b4bf..05e7f9f 100644 --- a/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml +++ b/TeaTimeDemo/Areas/Admin/Views/Order/Details.cshtml @@ -122,10 +122,25 @@ - - - - + @if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee) || User.IsInRole(SD.Role_Manager)) + { + @if (Model.OrderHeader.OrderStatus == SD.StatusPending) + { + + } + @if (Model.OrderHeader.OrderStatus == SD.StatusInProcess) + { + + } + @if (Model.OrderHeader.OrderStatus == SD.StatusReady) + { + + } + @if (Model.OrderHeader.OrderStatus != SD.StatusCompleted && Model.OrderHeader.OrderStatus != SD.StatusCancelled) + { + + } + }
-- GitLab From 27a366d55fde92ddee76bede721e896bc4188493 Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 17 Jul 2025 20:33:48 +0800 Subject: [PATCH 4/5] docs: add todo. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index df015cb..6798413 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # TeaTimeDemo +## TODO +- 資料庫初始化功能 for 架站輔助 +- 部署環境註冊權限限制 + +--- + - Just for practicing from book examples. - My Environment (For ref., you can choose your favorite stack): - Platform: **.NET 9** or **.NET 10** (preview) -- GitLab From a926fbefe16cd86fff80dfb96b24129177a3f002 Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 17 Jul 2025 20:35:37 +0800 Subject: [PATCH 5/5] Use IDE tool to Clean code. IDE: Visual Studio 2022 --- .../20250711041128_addIdentityTables.cs | 3 +-- ...716023745_AddOrderHeaderAndDetailestoDb.cs | 3 +-- .../Repository/ApplicationUserRepository.cs | 7 +------ .../Repository/CategoryRepository.cs | 7 +------ .../IRepository/IApplicationUserRepository.cs | 7 +------ .../IRepository/ICategoryRepository.cs | 7 +------ .../IRepository/IOrderDetailRepository.cs | 7 +------ .../IRepository/IOrderHeaderRepository.cs | 7 +------ .../IRepository/IProductRepository.cs | 7 +------ .../Repository/IRepository/IRepository.cs | 7 +------ .../IRepository/IShoppingCartRepository.cs | 7 +------ .../IRepository/IStoreRepository.cs | 7 +------ .../Repository/IRepository/IUnitOfWork.cs | 10 ++-------- .../Repository/OrderDetailRepository.cs | 7 +------ .../Repository/OrderHeaderRepository.cs | 11 +++------- .../Repository/ProductRepository.cs | 7 +------ .../Repository/Repository.cs | 9 ++------- .../Repository/ShoppingCartRepository.cs | 7 +------ .../Repository/StoreRepository.cs | 7 +------ .../Repository/UnitOfWork.cs | 8 +------- TeaTimeDemo.Models/Models/ApplicationUser.cs | 5 ----- TeaTimeDemo.Models/Models/Category.cs | 2 +- TeaTimeDemo.Models/Models/OrderDetail.cs | 5 ----- TeaTimeDemo.Models/Models/OrderHeader.cs | 9 ++------- TeaTimeDemo.Models/Models/Product.cs | 7 +------ TeaTimeDemo.Models/Models/ShoppingCart.cs | 7 +------ TeaTimeDemo.Models/Models/Store.cs | 7 +------ TeaTimeDemo.Models/ViewModels/OrderVM.cs | 7 +------ TeaTimeDemo.Models/ViewModels/ProductVM.cs | 5 ----- .../ViewModels/ShoppingCartVM.cs | 7 +------ TeaTimeDemo.Utility/EmailSender.cs | 5 ----- .../Admin/Controllers/CategoryController.cs | 2 -- .../Admin/Controllers/ProductController.cs | 6 ++---- .../Admin/Controllers/StoreController.cs | 6 +----- .../Customer/Controllers/CartController.cs | 12 +++++------ .../Customer/Controllers/HomeController.cs | 4 ++-- .../Pages/Account/ConfirmEmail.cshtml.cs | 6 +----- .../Account/ConfirmEmailChange.cshtml.cs | 5 +---- .../Pages/Account/ExternalLogin.cshtml.cs | 15 +++++--------- .../Pages/Account/ForgotPassword.cshtml.cs | 9 +++------ .../Identity/Pages/Account/Login.cshtml.cs | 9 +-------- .../Pages/Account/LoginWith2fa.cshtml.cs | 9 ++------- .../Account/LoginWithRecoveryCode.cshtml.cs | 6 +----- .../Identity/Pages/Account/Logout.cshtml.cs | 4 ---- .../Account/Manage/ChangePassword.cshtml.cs | 5 +---- .../Manage/DeletePersonalData.cshtml.cs | 5 +---- .../Pages/Account/Manage/Disable2fa.cshtml.cs | 3 --- .../Manage/DownloadPersonalData.cshtml.cs | 8 +------- .../Pages/Account/Manage/Email.cshtml.cs | 8 +++----- .../Manage/EnableAuthenticator.cshtml.cs | 10 +++------- .../Account/Manage/ExternalLogins.cshtml.cs | 5 ----- .../Manage/GenerateRecoveryCodes.cshtml.cs | 4 ---- .../Pages/Account/Manage/Index.cshtml.cs | 5 +---- .../Pages/Account/Manage/ManageNavPages.cs | 3 +-- .../Account/Manage/PersonalData.cshtml.cs | 3 --- .../Manage/ResetAuthenticator.cshtml.cs | 3 --- .../Account/Manage/SetPassword.cshtml.cs | 4 +--- .../Manage/ShowRecoveryCodes.cshtml.cs | 2 -- .../Manage/TwoFactorAuthentication.cshtml.cs | 3 --- .../Identity/Pages/Account/Register.cshtml.cs | 20 ++++++------------- .../Account/RegisterConfirmation.cshtml.cs | 4 +--- .../Account/ResendEmailConfirmation.cshtml.cs | 8 +++----- .../Pages/Account/ResetPassword.cshtml.cs | 7 ++----- .../Areas/Identity/Pages/Error.cshtml.cs | 2 +- TeaTimeDemo/Program.cs | 4 ++-- 65 files changed, 84 insertions(+), 333 deletions(-) diff --git a/TeaTimeDemo.DataAccess/Migrations/20250711041128_addIdentityTables.cs b/TeaTimeDemo.DataAccess/Migrations/20250711041128_addIdentityTables.cs index 02e81fe..c83c013 100644 --- a/TeaTimeDemo.DataAccess/Migrations/20250711041128_addIdentityTables.cs +++ b/TeaTimeDemo.DataAccess/Migrations/20250711041128_addIdentityTables.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/TeaTimeDemo.DataAccess/Migrations/20250716023745_AddOrderHeaderAndDetailestoDb.cs b/TeaTimeDemo.DataAccess/Migrations/20250716023745_AddOrderHeaderAndDetailestoDb.cs index da791e8..db437ff 100644 --- a/TeaTimeDemo.DataAccess/Migrations/20250716023745_AddOrderHeaderAndDetailestoDb.cs +++ b/TeaTimeDemo.DataAccess/Migrations/20250716023745_AddOrderHeaderAndDetailestoDb.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/TeaTimeDemo.DataAccess/Repository/ApplicationUserRepository.cs b/TeaTimeDemo.DataAccess/Repository/ApplicationUserRepository.cs index a2b2fe0..7b27f35 100644 --- a/TeaTimeDemo.DataAccess/Repository/ApplicationUserRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/ApplicationUserRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/CategoryRepository.cs b/TeaTimeDemo.DataAccess/Repository/CategoryRepository.cs index 5fdfa85..74705b1 100644 --- a/TeaTimeDemo.DataAccess/Repository/CategoryRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/CategoryRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IApplicationUserRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IApplicationUserRepository.cs index 975ebe7..122f7e5 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IApplicationUserRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IApplicationUserRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/ICategoryRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/ICategoryRepository.cs index 6f14761..cc4f17f 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/ICategoryRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/ICategoryRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderDetailRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderDetailRepository.cs index 5924f79..e0d7328 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderDetailRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderDetailRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderHeaderRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderHeaderRepository.cs index 9b4da26..3e00f82 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderHeaderRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IOrderHeaderRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IProductRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IProductRepository.cs index 46479b1..685aa7f 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IProductRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IProductRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IRepository.cs index a65e74a..c965049 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IShoppingCartRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IShoppingCartRepository.cs index b3d6703..1208c80 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IShoppingCartRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IShoppingCartRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IStoreRepository.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IStoreRepository.cs index 9f11b41..5802cd3 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IStoreRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IStoreRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository.IRepository { diff --git a/TeaTimeDemo.DataAccess/Repository/IRepository/IUnitOfWork.cs b/TeaTimeDemo.DataAccess/Repository/IRepository/IUnitOfWork.cs index c458df0..6e40fe2 100644 --- a/TeaTimeDemo.DataAccess/Repository/IRepository/IUnitOfWork.cs +++ b/TeaTimeDemo.DataAccess/Repository/IRepository/IUnitOfWork.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeaTimeDemo.DataAccess.Repository.IRepository +namespace TeaTimeDemo.DataAccess.Repository.IRepository { public interface IUnitOfWork { - ICategoryRepository Category { get; } + ICategoryRepository Category { get; } IProductRepository Product { get; } IStoreRepository Store { get; } IShoppingCartRepository ShoppingCart { get; } diff --git a/TeaTimeDemo.DataAccess/Repository/OrderDetailRepository.cs b/TeaTimeDemo.DataAccess/Repository/OrderDetailRepository.cs index a82e635..713d556 100644 --- a/TeaTimeDemo.DataAccess/Repository/OrderDetailRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/OrderDetailRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/OrderHeaderRepository.cs b/TeaTimeDemo.DataAccess/Repository/OrderHeaderRepository.cs index b9edc50..8b109eb 100644 --- a/TeaTimeDemo.DataAccess/Repository/OrderHeaderRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/OrderHeaderRepository.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository { @@ -24,7 +19,7 @@ namespace TeaTimeDemo.DataAccess.Repository public void UpdateStatus(int id, string orderStatus, string? paymentStatus = null) { - var orderFromDb = _db.OrderHeaders.FirstOrDefault(u => u.Id == id); + var orderFromDb = _db.OrderHeaders.FirstOrDefault(u => u.Id == id); if (orderFromDb != null) { orderFromDb.OrderStatus = orderStatus; diff --git a/TeaTimeDemo.DataAccess/Repository/ProductRepository.cs b/TeaTimeDemo.DataAccess/Repository/ProductRepository.cs index aed28b9..6cd53fc 100644 --- a/TeaTimeDemo.DataAccess/Repository/ProductRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/ProductRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/Repository.cs b/TeaTimeDemo.DataAccess/Repository/Repository.cs index 8834656..cbff0b0 100644 --- a/TeaTimeDemo.DataAccess/Repository/Repository.cs +++ b/TeaTimeDemo.DataAccess/Repository/Repository.cs @@ -1,10 +1,5 @@ using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; @@ -42,8 +37,8 @@ namespace TeaTimeDemo.DataAccess.Repository public IEnumerable GetAll(Expression>? filter = null, string? includeProperties = null) { IQueryable query = dbSet; - if(filter != null) - { + if (filter != null) + { query = query.Where(filter); } if (!string.IsNullOrEmpty(includeProperties)) diff --git a/TeaTimeDemo.DataAccess/Repository/ShoppingCartRepository.cs b/TeaTimeDemo.DataAccess/Repository/ShoppingCartRepository.cs index 6e905e2..3907f52 100644 --- a/TeaTimeDemo.DataAccess/Repository/ShoppingCartRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/ShoppingCartRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/StoreRepository.cs b/TeaTimeDemo.DataAccess/Repository/StoreRepository.cs index 93d0b64..f647439 100644 --- a/TeaTimeDemo.DataAccess/Repository/StoreRepository.cs +++ b/TeaTimeDemo.DataAccess/Repository/StoreRepository.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo.DataAccess/Repository/UnitOfWork.cs b/TeaTimeDemo.DataAccess/Repository/UnitOfWork.cs index 4c9941f..0a0ccea 100644 --- a/TeaTimeDemo.DataAccess/Repository/UnitOfWork.cs +++ b/TeaTimeDemo.DataAccess/Repository/UnitOfWork.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.DataAccess.Data; +using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; -using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.DataAccess.Repository { diff --git a/TeaTimeDemo.Models/Models/ApplicationUser.cs b/TeaTimeDemo.Models/Models/ApplicationUser.cs index 776f502..e653756 100644 --- a/TeaTimeDemo.Models/Models/ApplicationUser.cs +++ b/TeaTimeDemo.Models/Models/ApplicationUser.cs @@ -1,12 +1,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Models.Models { diff --git a/TeaTimeDemo.Models/Models/Category.cs b/TeaTimeDemo.Models/Models/Category.cs index a166aa0..5e6b080 100644 --- a/TeaTimeDemo.Models/Models/Category.cs +++ b/TeaTimeDemo.Models/Models/Category.cs @@ -12,7 +12,7 @@ namespace TeaTimeDemo.Models.Models [DisplayName("類別名稱")] public string? Name { get; set; } [DisplayName("類別順序")] - [Range(1,100)] + [Range(1, 100)] public int DisplayOrder { get; set; } } } \ No newline at end of file diff --git a/TeaTimeDemo.Models/Models/OrderDetail.cs b/TeaTimeDemo.Models/Models/OrderDetail.cs index 6473ffb..e3f7c80 100644 --- a/TeaTimeDemo.Models/Models/OrderDetail.cs +++ b/TeaTimeDemo.Models/Models/OrderDetail.cs @@ -1,11 +1,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Models.Models { diff --git a/TeaTimeDemo.Models/Models/OrderHeader.cs b/TeaTimeDemo.Models/Models/OrderHeader.cs index c592efa..1146ab6 100644 --- a/TeaTimeDemo.Models/Models/OrderHeader.cs +++ b/TeaTimeDemo.Models/Models/OrderHeader.cs @@ -1,11 +1,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Models.Models { @@ -21,7 +16,7 @@ namespace TeaTimeDemo.Models.Models public double OrderTotal { get; set; } // double to decimal? 算錢用浮點? public string? OrderStatus { get; set; } public string? PaymentStatus { get; set; } - public DateTime PaymentDate { get; set; } + public DateTime PaymentDate { get; set; } public DateTime PaymentDueDate { get; set; } public string? SessionId { get; set; } [Required] @@ -30,6 +25,6 @@ namespace TeaTimeDemo.Models.Models public string Address { get; set; } [Required] public string Name { get; set; } - + } } diff --git a/TeaTimeDemo.Models/Models/Product.cs b/TeaTimeDemo.Models/Models/Product.cs index 13c43a7..f33c518 100644 --- a/TeaTimeDemo.Models/Models/Product.cs +++ b/TeaTimeDemo.Models/Models/Product.cs @@ -1,11 +1,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Models.Models { @@ -17,7 +12,7 @@ namespace TeaTimeDemo.Models.Models [Required] public string Size { get; set; } [Required] - [Range (1, 10000)] + [Range(1, 10000)] public double Price { get; set; } public string Description { get; set; } public int CategoryId { get; set; } diff --git a/TeaTimeDemo.Models/Models/ShoppingCart.cs b/TeaTimeDemo.Models/Models/ShoppingCart.cs index 137586c..8434486 100644 --- a/TeaTimeDemo.Models/Models/ShoppingCart.cs +++ b/TeaTimeDemo.Models/Models/ShoppingCart.cs @@ -1,11 +1,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Models.Models { @@ -18,7 +13,7 @@ namespace TeaTimeDemo.Models.Models public Product Product { get; set; } [Range(1, 100, ErrorMessage = "給我輸入 1 到 100 的數字啊 (惱")] public int Count { get; set; } - public string Ice { get; set; } + public string Ice { get; set; } public string Sweetness { get; set; } public string ApplicationUserId { get; set; } [ForeignKey("ApplicationUserId")] diff --git a/TeaTimeDemo.Models/Models/Store.cs b/TeaTimeDemo.Models/Models/Store.cs index 342629d..6e4a04c 100644 --- a/TeaTimeDemo.Models/Models/Store.cs +++ b/TeaTimeDemo.Models/Models/Store.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Models.Models { diff --git a/TeaTimeDemo.Models/ViewModels/OrderVM.cs b/TeaTimeDemo.Models/ViewModels/OrderVM.cs index 5afa05f..6c364ba 100644 --- a/TeaTimeDemo.Models/ViewModels/OrderVM.cs +++ b/TeaTimeDemo.Models/ViewModels/OrderVM.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.Models.ViewModels { diff --git a/TeaTimeDemo.Models/ViewModels/ProductVM.cs b/TeaTimeDemo.Models/ViewModels/ProductVM.cs index 73721d0..b18bc00 100644 --- a/TeaTimeDemo.Models/ViewModels/ProductVM.cs +++ b/TeaTimeDemo.Models/ViewModels/ProductVM.cs @@ -1,10 +1,5 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.Rendering; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.Models.ViewModels diff --git a/TeaTimeDemo.Models/ViewModels/ShoppingCartVM.cs b/TeaTimeDemo.Models/ViewModels/ShoppingCartVM.cs index 98f6081..0caa53e 100644 --- a/TeaTimeDemo.Models/ViewModels/ShoppingCartVM.cs +++ b/TeaTimeDemo.Models/ViewModels/ShoppingCartVM.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeaTimeDemo.Models.Models; +using TeaTimeDemo.Models.Models; namespace TeaTimeDemo.Models.ViewModels { diff --git a/TeaTimeDemo.Utility/EmailSender.cs b/TeaTimeDemo.Utility/EmailSender.cs index c2d7c4b..4ab1c0e 100644 --- a/TeaTimeDemo.Utility/EmailSender.cs +++ b/TeaTimeDemo.Utility/EmailSender.cs @@ -1,9 +1,4 @@ using Microsoft.AspNetCore.Identity.UI.Services; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace TeaTimeDemo.Utility { diff --git a/TeaTimeDemo/Areas/Admin/Controllers/CategoryController.cs b/TeaTimeDemo/Areas/Admin/Controllers/CategoryController.cs index a800974..9543617 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/CategoryController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/CategoryController.cs @@ -1,7 +1,5 @@ -using Humanizer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; using TeaTimeDemo.Utility; diff --git a/TeaTimeDemo/Areas/Admin/Controllers/ProductController.cs b/TeaTimeDemo/Areas/Admin/Controllers/ProductController.cs index ce0cbd6..3a494be 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/ProductController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/ProductController.cs @@ -1,7 +1,5 @@ -using Humanizer; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; -using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; using TeaTimeDemo.Models.ViewModels; @@ -44,7 +42,7 @@ namespace TeaTimeDemo.Areas.Admin.Controllers else { //執行編輯 - productVM.Product = _unitOfWork.Product.Get(u => u.Id == id); + productVM.Product = _unitOfWork.Product.Get(u => u.Id == id); return View(productVM); } } @@ -105,7 +103,7 @@ namespace TeaTimeDemo.Areas.Admin.Controllers public IActionResult GetAll() { List objProductList = - _unitOfWork.Product.GetAll(includeProperties:"Category").ToList(); + _unitOfWork.Product.GetAll(includeProperties: "Category").ToList(); return Json(new { data = objProductList }); } [HttpDelete] diff --git a/TeaTimeDemo/Areas/Admin/Controllers/StoreController.cs b/TeaTimeDemo/Areas/Admin/Controllers/StoreController.cs index 4267163..d65c45f 100644 --- a/TeaTimeDemo/Areas/Admin/Controllers/StoreController.cs +++ b/TeaTimeDemo/Areas/Admin/Controllers/StoreController.cs @@ -1,11 +1,7 @@ -using Humanizer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Rendering; -using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; -using TeaTimeDemo.Models.ViewModels; using TeaTimeDemo.Utility; namespace TeaTimeDemo.Areas.Admin.Controllers @@ -35,7 +31,7 @@ namespace TeaTimeDemo.Areas.Admin.Controllers else { //執行編輯 - Store storeObj = _unitOfWork.Store.Get(u => u.Id == id); + Store storeObj = _unitOfWork.Store.Get(u => u.Id == id); return View(); } } diff --git a/TeaTimeDemo/Areas/Customer/Controllers/CartController.cs b/TeaTimeDemo/Areas/Customer/Controllers/CartController.cs index 63a23e0..bd5cadf 100644 --- a/TeaTimeDemo/Areas/Customer/Controllers/CartController.cs +++ b/TeaTimeDemo/Areas/Customer/Controllers/CartController.cs @@ -29,7 +29,7 @@ namespace TeaTimeDemo.Areas.Customer.Controllers ShoppingCartList = _unitOfWork.ShoppingCart.GetAll(u => u.ApplicationUserId == userId, includeProperties: "Product"), OrderHeader = new() }; - foreach (var cart in ShoppingCartVM.ShoppingCartList) + foreach (var cart in ShoppingCartVM.ShoppingCartList) { ShoppingCartVM.OrderHeader.OrderTotal += (cart.Product.Price * cart.Count); } @@ -37,7 +37,7 @@ namespace TeaTimeDemo.Areas.Customer.Controllers } public IActionResult Summary() { - var claimsIdentity = (ClaimsIdentity) User.Identity; + var claimsIdentity = (ClaimsIdentity)User.Identity; var userId = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier).Value; ShoppingCartVM = new ShoppingCartVM() { @@ -108,7 +108,7 @@ namespace TeaTimeDemo.Areas.Customer.Controllers public IActionResult Plus(int cartId) { var cartFromDb = _unitOfWork.ShoppingCart.Get(u => u.Id == cartId); - cartFromDb.Count ++; + cartFromDb.Count++; _unitOfWork.ShoppingCart.Update(cartFromDb); _unitOfWork.Save(); return RedirectToAction(nameof(Index)); @@ -123,16 +123,16 @@ namespace TeaTimeDemo.Areas.Customer.Controllers } else { - cartFromDb.Count --; + cartFromDb.Count--; _unitOfWork.ShoppingCart.Update(cartFromDb); } - _unitOfWork.Save (); + _unitOfWork.Save(); return RedirectToAction(nameof(Index)); } public IActionResult Remove(int cartId) { var cartFromDb = _unitOfWork.ShoppingCart.Get(u => u.Id == cartId); - _unitOfWork.ShoppingCart.Remove (cartFromDb); + _unitOfWork.ShoppingCart.Remove(cartFromDb); _unitOfWork.Save(); return RedirectToAction(nameof(Index)); } diff --git a/TeaTimeDemo/Areas/Customer/Controllers/HomeController.cs b/TeaTimeDemo/Areas/Customer/Controllers/HomeController.cs index 492473d..ff713e2 100644 --- a/TeaTimeDemo/Areas/Customer/Controllers/HomeController.cs +++ b/TeaTimeDemo/Areas/Customer/Controllers/HomeController.cs @@ -1,7 +1,7 @@ -using System.Diagnostics; -using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using System.Diagnostics; +using System.Security.Claims; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs index 656c53b..6d7e28d 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs @@ -2,15 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.Text; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs index 0a64344..d2ed30e 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs @@ -2,14 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.Text; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs index 1c25c51..f609ab6 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs @@ -2,21 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Security.Claims; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; +using System.Security.Claims; +using System.Text; +using System.Text.Encodings.Web; namespace TeaTimeDemo.Areas.Identity.Pages.Account { @@ -85,7 +80,7 @@ namespace TeaTimeDemo.Areas.Identity.Pages.Account [EmailAddress] public string Email { get; set; } } - + public IActionResult OnGet() => RedirectToPage("./Login"); public IActionResult OnPost(string provider, string returnUrl = null) diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs index b60c79c..3dc1c8f 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs @@ -2,17 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.ComponentModel.DataAnnotations; +using System.Text; +using System.Text.Encodings.Web; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Login.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Login.cshtml.cs index 36a6ff0..c24eff9 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Login.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Login.cshtml.cs @@ -2,18 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs index 7774d90..d344c76 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs @@ -2,15 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; -using Microsoft.AspNetCore.Identity; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs index 4876b0c..45918c0 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs @@ -2,14 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account { public class LoginWithRecoveryCodeModel : PageModel diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Logout.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Logout.cshtml.cs index 40eeee8..ecc9190 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Logout.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Logout.cshtml.cs @@ -2,13 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs index d60df00..0ddd868 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs @@ -2,13 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs index 123b7a6..8bc48a0 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs @@ -2,13 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs index c1f487c..25408f9 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs @@ -2,12 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs index ea61e11..0698c97 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs @@ -2,16 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using System.Text.Json; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs index b37422a..cdd2035 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs @@ -2,16 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.ComponentModel.DataAnnotations; +using System.Text; +using System.Text.Encodings.Web; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs index e6f6379..a3bed34 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs @@ -2,17 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; using System.ComponentModel.DataAnnotations; using System.Globalization; -using System.Linq; using System.Text; using System.Text.Encodings.Web; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs index 99c0d12..00a2eab 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs index 3d8a179..8bee93e 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs @@ -2,13 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs index b757e79..33ff0b4 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs @@ -2,13 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Text.Encodings.Web; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs index 40cf071..4d90935 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs @@ -2,10 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; using Microsoft.AspNetCore.Mvc.Rendering; -namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage +namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs index 244a30c..23918f0 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs index 823d297..2f3b28e 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs @@ -2,12 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs index 3b9efb0..a8f88e0 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs @@ -2,12 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using System.ComponentModel.DataAnnotations; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs index befcda0..160531b 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs @@ -2,10 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs index 765511c..c06e7f1 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs @@ -2,12 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace TeaTimeDemo.Areas.Identity.Pages.Account.Manage { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/Register.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/Register.cshtml.cs index d9859ac..57d397c 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/Register.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/Register.cshtml.cs @@ -2,24 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.WebUtilities; -using Microsoft.Extensions.Logging; +using System.ComponentModel.DataAnnotations; +using System.Text; +using System.Text.Encodings.Web; using TeaTimeDemo.DataAccess.Repository.IRepository; using TeaTimeDemo.Models.Models; using TeaTimeDemo.Utility; @@ -99,7 +91,7 @@ namespace TeaTimeDemo.Areas.Identity.Pages.Account [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } - public string? Role { get; set; } + public string? Role { get; set; } [Required] public string Name { get; set; } public string? Address { get; set; } @@ -130,7 +122,7 @@ namespace TeaTimeDemo.Areas.Identity.Pages.Account } Input = new() { - RoleList = _roleManager.Roles.Select( x => x.Name ).Select(i => new SelectListItem + RoleList = _roleManager.Roles.Select(x => x.Name).Select(i => new SelectListItem { Text = i, Value = i @@ -175,7 +167,7 @@ namespace TeaTimeDemo.Areas.Identity.Pages.Account { await _userManager.AddToRoleAsync(user, SD.Role_Customer); } - var userId = await _userManager.GetUserIdAsync(user); + var userId = await _userManager.GetUserIdAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); var callbackUrl = Url.Page( diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs index 8b17705..b1046da 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs @@ -2,15 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.Text; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.Text; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs index b9897a9..5b15b55 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs @@ -2,17 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.ComponentModel.DataAnnotations; +using System.Text; +using System.Text.Encodings.Web; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs index fb98033..a8e7cb6 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs @@ -2,15 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System; -using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using System.ComponentModel.DataAnnotations; +using System.Text; namespace TeaTimeDemo.Areas.Identity.Pages.Account { diff --git a/TeaTimeDemo/Areas/Identity/Pages/Error.cshtml.cs b/TeaTimeDemo/Areas/Identity/Pages/Error.cshtml.cs index 3d74dac..6ecb8bd 100644 --- a/TeaTimeDemo/Areas/Identity/Pages/Error.cshtml.cs +++ b/TeaTimeDemo/Areas/Identity/Pages/Error.cshtml.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #nullable disable -using System.Diagnostics; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Diagnostics; namespace TeaTimeDemo.Areas.Identity.Pages { diff --git a/TeaTimeDemo/Program.cs b/TeaTimeDemo/Program.cs index 1cea4e3..bbb9dc0 100644 --- a/TeaTimeDemo/Program.cs +++ b/TeaTimeDemo/Program.cs @@ -1,10 +1,10 @@ +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.EntityFrameworkCore; using TeaTimeDemo.DataAccess.Data; using TeaTimeDemo.DataAccess.Repository; using TeaTimeDemo.DataAccess.Repository.IRepository; -using Microsoft.AspNetCore.Identity; using TeaTimeDemo.Utility; -using Microsoft.AspNetCore.Identity.UI.Services; var builder = WebApplication.CreateBuilder(args); -- GitLab