├── Bulky ├── BulkyWeb │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── Shared │ │ │ ├── Components │ │ │ │ └── ShoppingCart │ │ │ │ │ └── Default.cshtml │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ ├── _Notification.cshtml │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml.css │ │ │ └── _LoginPartial.cshtml │ │ └── _ViewImports.cshtml │ ├── Areas │ │ ├── Admin │ │ │ ├── Views │ │ │ │ ├── _ViewStart.cshtml │ │ │ │ ├── _ViewImports.cshtml │ │ │ │ ├── Order │ │ │ │ │ ├── PaymentConfirmation.cshtml │ │ │ │ │ └── Index.cshtml │ │ │ │ ├── User │ │ │ │ │ ├── Index.cshtml │ │ │ │ │ └── RoleManagment.cshtml │ │ │ │ ├── Company │ │ │ │ │ └── Index.cshtml │ │ │ │ ├── Product │ │ │ │ │ └── Index.cshtml │ │ │ │ └── Category │ │ │ │ │ ├── Edit.cshtml │ │ │ │ │ ├── Delete.cshtml │ │ │ │ │ ├── Create.cshtml │ │ │ │ │ └── Index.cshtml │ │ │ └── Controllers │ │ │ │ ├── CompanyController.cs │ │ │ │ └── CategoryController.cs │ │ ├── Customer │ │ │ ├── Views │ │ │ │ ├── _ViewStart.cshtml │ │ │ │ ├── Home │ │ │ │ │ ├── Privacy.cshtml │ │ │ │ │ └── Index.cshtml │ │ │ │ ├── _ViewImports.cshtml │ │ │ │ └── Cart │ │ │ │ │ └── OrderConfirmation.cshtml │ │ │ └── Controllers │ │ │ │ └── HomeController.cs │ │ └── Identity │ │ │ └── Pages │ │ │ ├── Account │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Manage │ │ │ │ ├── _ViewStart.cshtml │ │ │ │ ├── _ViewImports.cshtml │ │ │ │ ├── DownloadPersonalData.cshtml │ │ │ │ ├── _StatusMessage.cshtml │ │ │ │ ├── _Layout.cshtml │ │ │ │ ├── Disable2fa.cshtml │ │ │ │ ├── ShowRecoveryCodes.cshtml │ │ │ │ ├── PersonalData.cshtml │ │ │ │ ├── ResetAuthenticator.cshtml │ │ │ │ ├── GenerateRecoveryCodes.cshtml │ │ │ │ ├── _ManageNav.cshtml │ │ │ │ ├── PersonalData.cshtml.cs │ │ │ │ ├── DeletePersonalData.cshtml │ │ │ │ ├── Index.cshtml │ │ │ │ ├── SetPassword.cshtml │ │ │ │ ├── ChangePassword.cshtml │ │ │ │ ├── ShowRecoveryCodes.cshtml.cs │ │ │ │ ├── Email.cshtml │ │ │ │ ├── ExternalLogins.cshtml │ │ │ │ ├── DownloadPersonalData.cshtml.cs │ │ │ │ ├── EnableAuthenticator.cshtml │ │ │ │ ├── Disable2fa.cshtml.cs │ │ │ │ ├── ResetAuthenticator.cshtml.cs │ │ │ │ ├── TwoFactorAuthentication.cshtml │ │ │ │ ├── GenerateRecoveryCodes.cshtml.cs │ │ │ │ ├── TwoFactorAuthentication.cshtml.cs │ │ │ │ └── DeletePersonalData.cshtml.cs │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ConfirmEmailChange.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── AccessDenied.cshtml │ │ │ ├── Lockout.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _StatusMessage.cshtml │ │ │ ├── Logout.cshtml │ │ │ ├── RegisterConfirmation.cshtml │ │ │ ├── AccessDenied.cshtml.cs │ │ │ ├── ResendEmailConfirmation.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── Lockout.cshtml.cs │ │ │ ├── ForgotPasswordConfirmation.cshtml.cs │ │ │ ├── ResetPasswordConfirmation.cshtml.cs │ │ │ ├── LoginWithRecoveryCode.cshtml │ │ │ ├── Logout.cshtml.cs │ │ │ ├── LoginWith2fa.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ConfirmEmail.cshtml.cs │ │ │ ├── ConfirmEmailChange.cshtml.cs │ │ │ ├── RegisterConfirmation.cshtml.cs │ │ │ ├── ExternalLogin.cshtml │ │ │ ├── ResendEmailConfirmation.cshtml.cs │ │ │ └── ForgotPassword.cshtml.cs │ │ │ ├── _ViewStart.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Error.cshtml │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ └── Error.cshtml.cs │ ├── wwwroot │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── book.png │ │ │ └── lawn_leaf.jpg │ │ ├── js │ │ │ ├── site.js │ │ │ ├── order.js │ │ │ ├── product.js │ │ │ ├── company.js │ │ │ └── user.js │ │ └── lib │ │ │ ├── jquery │ │ │ └── LICENSE.txt │ │ │ ├── jquery-validation │ │ │ └── LICENSE.md │ │ │ ├── bootstrap │ │ │ ├── LICENSE │ │ │ └── dist │ │ │ │ └── css │ │ │ │ └── bootstrap-reboot.min.css │ │ │ └── jquery-validation-unobtrusive │ │ │ └── LICENSE.txt │ ├── appsettings.Development.json │ ├── .config │ │ └── dotnet-tools.json │ ├── appsettings.json │ ├── appsettings.Production.json │ ├── Properties │ │ └── launchSettings.json │ ├── ViewComponents │ │ └── ShoppingCartViewComponent.cs │ ├── BulkyBookWeb.csproj │ └── Program.cs ├── Bulky new │ └── Image │ │ ├── 57601643.jpg │ │ ├── 68004512.jpg │ │ ├── 9781250317759.jpg │ │ ├── 61CNu0r+JLL._SL1400_.jpg │ │ ├── 81ozr-phoSL._SY466_.jpg │ │ ├── 81ThvGN23yL._AC_UF1000,1000_QL80_.jpg │ │ ├── 0c9829b3-ea85-409e-974a-4081d93c6030.jpg │ │ ├── 5c109b70-78b1-4d07-b77a-51df94f26717.jpg │ │ ├── 9b2c93d0-6f21-4192-9d1a-57689a3470fe.jpg │ │ ├── bb02ab8a-93e0-4051-afd3-55f74dd9c93e.jpg │ │ ├── e5a0766c-25b2-415d-9007-ee693ddfeb7f.jpg │ │ ├── ee6e44e0-3eab-41e1-8f4d-402c927d969a.jpg │ │ ├── f43a20f7-042d-4ab6-943f-d30aef346df7.jpg │ │ ├── f532ac58-4ffa-4b6e-a373-347eb2ea4e5a.jpg │ │ ├── chokher-bali-original-imaf82hhvgygwzgs.webp │ │ └── rabindranath-tagores-great-fiction-work-chokher-bali.jpg ├── Bulky.Models │ ├── ErrorViewModel.cs │ ├── ViewModels │ │ ├── OrderVM.cs │ │ ├── ShoppingCartVM.cs │ │ ├── ProductVM.cs │ │ └── RoleManagmentVM.cs │ ├── BulkyBook.Models.csproj │ ├── Category.cs │ ├── ProductImage.cs │ ├── Company.cs │ ├── OrderDetail.cs │ ├── ApplicationUser.cs │ ├── ShoppingCart.cs │ ├── Product.cs │ └── OrderHeader.cs ├── Bulky.DataAccess │ ├── DbInitializer │ │ ├── IDbInitializer.cs │ │ └── DbInitializer.cs │ ├── Repository │ │ ├── IRepository │ │ │ ├── ICompanyRepository.cs │ │ │ ├── IProductRepository.cs │ │ │ ├── ICategoryRepository.cs │ │ │ ├── IOrderDetailRepository.cs │ │ │ ├── IProductImageRepository.cs │ │ │ ├── IShoppingCartRepository.cs │ │ │ ├── IApplicationUserRepository.cs │ │ │ ├── IOrderHeaderRepository.cs │ │ │ ├── IRepository.cs │ │ │ └── IUnitOfWork.cs │ │ ├── CategoryRepository.cs │ │ ├── CompanyRepository.cs │ │ ├── ProductImageRepository.cs │ │ ├── OrderDetailRepository.cs │ │ ├── ShoppingCartRepository.cs │ │ ├── ApplicationUserRepository.cs │ │ ├── ProductRepository.cs │ │ ├── OrderHeaderRepository.cs │ │ ├── UnitOfWork.cs │ │ └── Repository.cs │ ├── BulkyBook.DataAccess.csproj │ └── Migrations │ │ ├── 20230927195406_addProductImageToDb.cs │ │ └── 20230927194726_removeImageUrl.cs ├── Bulky.Utility │ ├── StripeSettings.cs │ ├── BulkyBook.Utility.csproj │ ├── SD.cs │ └── EmailSender.cs └── Bulky.sln ├── LICENSE ├── .gitattributes └── README.md /Bulky/BulkyWeb/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBookWeb.Areas.Identity.Pages.Account -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | Layout = "_Layout.cshtml"; 4 | } 5 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | Layout = "/Views/Shared/_Layout.cshtml"; 4 | } 5 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBookWeb.Areas.Identity.Pages.Account.Manage -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/Components/ShoppingCart/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model int 2 | 3 |   (@Model) -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/57601643.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/57601643.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/68004512.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/68004512.jpg -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/BulkyWeb/wwwroot/favicon.ico -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/9781250317759.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/9781250317759.jpg -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/images/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/BulkyWeb/wwwroot/images/book.png -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/images/lawn_leaf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/BulkyWeb/wwwroot/images/lawn_leaf.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/61CNu0r+JLL._SL1400_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/61CNu0r+JLL._SL1400_.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/81ozr-phoSL._SY466_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/81ozr-phoSL._SY466_.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/81ThvGN23yL._AC_UF1000,1000_QL80_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/81ThvGN23yL._AC_UF1000,1000_QL80_.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/0c9829b3-ea85-409e-974a-4081d93c6030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/0c9829b3-ea85-409e-974a-4081d93c6030.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/5c109b70-78b1-4d07-b77a-51df94f26717.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/5c109b70-78b1-4d07-b77a-51df94f26717.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/9b2c93d0-6f21-4192-9d1a-57689a3470fe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/9b2c93d0-6f21-4192-9d1a-57689a3470fe.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/bb02ab8a-93e0-4051-afd3-55f74dd9c93e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/bb02ab8a-93e0-4051-afd3-55f74dd9c93e.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/e5a0766c-25b2-415d-9007-ee693ddfeb7f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/e5a0766c-25b2-415d-9007-ee693ddfeb7f.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/ee6e44e0-3eab-41e1-8f4d-402c927d969a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/ee6e44e0-3eab-41e1-8f4d-402c927d969a.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/f43a20f7-042d-4ab6-943f-d30aef346df7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/f43a20f7-042d-4ab6-943f-d30aef346df7.jpg -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/f532ac58-4ffa-4b6e-a373-347eb2ea4e5a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/f532ac58-4ffa-4b6e-a373-347eb2ea4e5a.jpg -------------------------------------------------------------------------------- /Bulky/BulkyWeb/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/chokher-bali-original-imaf82hhvgygwzgs.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/chokher-bali-original-imaf82hhvgygwzgs.webp -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Use this page to detail your site's privacy policy.

7 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBookWeb 2 | @using BulkyBook.Models 3 | @using BulkyBook.Utility 4 | @using BulkyBook.Models.ViewModels 5 | 6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 7 | -------------------------------------------------------------------------------- /Bulky/Bulky new/Image/rabindranath-tagores-great-fiction-work-chokher-bali.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deboraj-roy/ASP.NET-Core-MVC-NET-8/HEAD/Bulky/Bulky new/Image/rabindranath-tagores-great-fiction-work-chokher-bali.jpg -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBookWeb 2 | @using BulkyBook.Models 3 | @using BulkyBook.Models.ViewModels 4 | @using BulkyBook.Utility 5 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 6 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBookWeb 2 | @using BulkyBook.Models 3 | @using BulkyBook.Utility 4 | @using BulkyBook.Models.ViewModels 5 | 6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 7 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "7.0.11", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BulkyBook.Models 2 | { 3 | public class ErrorViewModel 4 | { 5 | public string? RequestId { get; set; } 6 | 7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 8 | } 9 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ConfirmEmailModel 3 | @{ 4 | ViewData["Title"] = "Confirm email"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ConfirmEmailChangeModel 3 | @{ 4 | ViewData["Title"] = "Confirm email change"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ForgotPasswordConfirmation 3 | @{ 4 | ViewData["Title"] = "Forgot password confirmation"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

9 | Please check your email to reset your password. 10 |

11 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BulkyBook.Models 2 | @using BulkyBook.Utility 3 | @using BulkyBookWeb.Areas.Identity 4 | @using BulkyBook.Models.ViewModels 5 | @using Microsoft.AspNetCore.Identity 6 | @using BulkyBookWeb.Areas.Identity.Pages 7 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 8 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model AccessDeniedModel 3 | @{ 4 | ViewData["Title"] = "Access denied"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 |

You do not have access to this resource.

10 |
11 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LockoutModel 3 | @{ 4 | ViewData["Title"] = "Locked out"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 |

This account has been locked out, please try again later.

10 |
11 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ResetPasswordConfirmationModel 3 | @{ 4 | ViewData["Title"] = "Reset password confirmation"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

9 | Your password has been reset. Please click here to log in. 10 |

11 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/DbInitializer/IDbInitializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.DataAccess.DbInitializer 8 | { 9 | public interface IDbInitializer 10 | { 11 | void Initialize(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Bulky/Bulky.Utility/StripeSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.Utility 8 | { 9 | public class StripeSettings 10 | { 11 | public string SecretKey { get; set; } 12 | public string PublishableKey { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model DownloadPersonalDataModel 3 | @{ 4 | ViewData["Title"] = "Download Your Data"; 5 | ViewData["ActivePage"] = ManageNavPages.PersonalData; 6 | } 7 | 8 |

@ViewData["Title"]

9 | 10 | @section Scripts { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ViewModels/OrderVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.Models.ViewModels 8 | { 9 | public class OrderVM 10 | { 11 | public OrderHeader OrderHeader { get; set; } 12 | public IEnumerable OrderDetail { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/ICompanyRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface ICompanyRepository : IRepository 11 | { 12 | void Update(Company obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IProductRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IProductRepository : IRepository 11 | { 12 | void Update(Product obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/ICategoryRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface ICategoryRepository : IRepository 11 | { 12 | void Update(Category obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ViewModels/ShoppingCartVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.Models.ViewModels 8 | { 9 | public class ShoppingCartVM 10 | { 11 | public IEnumerable ShoppingCartList { get; set; } 12 | 13 | public OrderHeader OrderHeader { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/_StatusMessage.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @if (!String.IsNullOrEmpty(Model)) 4 | { 5 | var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; 6 | 10 | } 11 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IOrderDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IOrderDetailRepository : IRepository 11 | { 12 | void Update(OrderDetail obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IProductImageRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IProductImageRepository : IRepository 11 | { 12 | void Update(ProductImage obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IShoppingCartRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IShoppingCartRepository : IRepository 11 | { 12 | void Update(ShoppingCart obj); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/_StatusMessage.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @if (!String.IsNullOrEmpty(Model)) 4 | { 5 | var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; 6 | 10 | } 11 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IApplicationUserRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IApplicationUserRepository : IRepository 11 | { 12 | public void Update(ApplicationUser applicationUser); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.Utility/BulkyBook.Utility.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/BulkyBook.Models.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Views/Cart/OrderConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @model int 2 | 3 |
4 |
5 |

Order Placed Successfully!

6 | Your Order Number is : @Model

7 | 8 |
9 |
10 |
11 | Your order has been placed successfully!
12 |
13 | 14 |
-------------------------------------------------------------------------------- /Bulky/Bulky.Models/ViewModels/ProductVM.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 2 | using Microsoft.AspNetCore.Mvc.Rendering; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace BulkyBook.Models.ViewModels 10 | { 11 | public class ProductVM 12 | { 13 | public Product Product { get; set; } 14 | [ValidateNever] 15 | public IEnumerable CategoryList { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ViewModels/RoleManagmentVM.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Rendering; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.Models.ViewModels 9 | { 10 | public class RoleManagmentVM 11 | { 12 | public ApplicationUser ApplicationUser { get; set; } 13 | public IEnumerable RoleList { get; set; } 14 | public IEnumerable CompanyList { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/Category.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace BulkyBook.Models 5 | { 6 | public class Category 7 | { 8 | [Key] 9 | public int Id { get; set; } 10 | [Required] 11 | [MaxLength(30)] 12 | [DisplayName("Category Name")] 13 | public string Name { get; set; } 14 | [DisplayName("Display Order")] 15 | [Range(1, 100, ErrorMessage = "Display Order must be between 1-100")] 16 | public int DisplayOrder { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IOrderHeaderRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IOrderHeaderRepository : IRepository 11 | { 12 | void Update(OrderHeader obj); 13 | void UpdateStatus(int id, string orderStatus, string? paymentStatus = null); 14 | void UpdateStripePaymentID(int id, string sessionId, string paymentIntentId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ProductImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace BulkyBook.Models 10 | { 11 | public class ProductImage 12 | { 13 | 14 | public int Id { get; set; } 15 | [Required] 16 | public string ImageUrl { get; set; } 17 | public int ProductId { get; set; } 18 | [ForeignKey("ProductId")] 19 | public Product Product { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/Company.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.Models 9 | { 10 | public class Company 11 | { 12 | public int Id { get; set; } 13 | [Required] 14 | public string Name { get; set; } 15 | public string? StreetAddress { get; set; } 16 | public string? City { get; set; } 17 | public string? State { get; set; } 18 | public string? PostalCode { get; set; } 19 | public string? PhoneNumber { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/_Notification.cshtml: -------------------------------------------------------------------------------- 1 | @if (TempData["success"] != null) 2 | { 3 | 4 | 5 | 8 | } 9 | @if (TempData["error"] != null) 10 | { 11 | 12 | 13 | 16 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Order/PaymentConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @model int 2 | 3 |
4 |
5 |

Payment Successful!

6 | Order Number : @Model

7 | 8 |
9 |
10 |
11 | Payment has been applied successfully!
12 | Back to Order Details 16 | 17 |
18 | 19 |
-------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LogoutModel 3 | @{ 4 | ViewData["Title"] = "Log out"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 | @{ 10 | if (User.Identity?.IsAuthenticated ?? false) 11 | { 12 |
13 | 14 |
15 | } 16 | else 17 | { 18 |

You have successfully logged out of the application.

19 | } 20 | } 21 |
22 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model RegisterConfirmationModel 3 | @{ 4 | ViewData["Title"] = "Register confirmation"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | @{ 9 | if (@Model.DisplayConfirmAccountLink) 10 | { 11 |

12 | This app does not currently have a real email sender registered, see these docs for how to configure a real email sender. 13 | Normally this would be emailed: Click here to confirm your account 14 |

15 | } 16 | else 17 | { 18 |

19 | Please check your email to confirm your account. 20 |

21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BulkyBook.DataAccess.Repository.IRepository 9 | { 10 | public interface IRepository where T : class 11 | { 12 | // T - Category 13 | IEnumerable GetAll(Expression>? filter = null, string? includeProperties = null); 14 | T Get(Expression> filter, string? includeProperties = null, bool tracked = false); 15 | void Add(T entity); 16 | void Remove(T entity); 17 | void RemoveRange(IEnumerable entities); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | if (ViewData.TryGetValue("ParentLayout", out var parentLayout) && parentLayout != null) 3 | { 4 | Layout = parentLayout.ToString(); 5 | } 6 | else 7 | { 8 | Layout = "/Views/Shared/_Layout.cshtml"; 9 | } 10 | } 11 | 12 |

Manage your account

13 | 14 |
15 |

Change your account settings

16 |
17 |
18 |
19 | 20 |
21 |
22 | @RenderBody() 23 |
24 |
25 |
26 | 27 | @section Scripts { 28 | @RenderSection("Scripts", required: false) 29 | } 30 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/CategoryRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class CategoryRepository : Repository, ICategoryRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public CategoryRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | public void Update(Category obj) 21 | { 22 | _db.Categories.Update(obj); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/CompanyRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class CompanyRepository : Repository, ICompanyRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public CompanyRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | 21 | 22 | public void Update(Company obj) 23 | { 24 | _db.Companies.Update(obj); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/IRepository/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.DataAccess.Repository.IRepository 8 | { 9 | public interface IUnitOfWork 10 | { 11 | ICategoryRepository Category { get; } 12 | IProductRepository Product { get; } 13 | ICompanyRepository Company { get; } 14 | IShoppingCartRepository ShoppingCart { get; } 15 | IApplicationUserRepository ApplicationUser { get; } 16 | IOrderDetailRepository OrderDetail { get; } 17 | IOrderHeaderRepository OrderHeader { get; } 18 | IProductImageRepository ProductImage { get; } 19 | 20 | void Save(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/ProductImageRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class ProductImageRepository : Repository, IProductImageRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public ProductImageRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | public void Update(ProductImage obj) 21 | { 22 | _db.ProductImages.Update(obj); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/OrderDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class OrderDetailRepository : Repository, IOrderDetailRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public OrderDetailRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | 21 | 22 | public void Update(OrderDetail obj) 23 | { 24 | _db.OrderDetails.Update(obj); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/ShoppingCartRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BulkyBook.DataAccess.Repository 12 | { 13 | public class ShoppingCartRepository : Repository, IShoppingCartRepository 14 | { 15 | private ApplicationDbContext _db; 16 | public ShoppingCartRepository(ApplicationDbContext db) : base(db) 17 | { 18 | _db = db; 19 | } 20 | 21 | 22 | 23 | public void Update(ShoppingCart obj) 24 | { 25 | _db.ShoppingCarts.Update(obj); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/ApplicationUserRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BulkyBook.DataAccess.Repository 12 | { 13 | public class ApplicationUserRepository : Repository, IApplicationUserRepository 14 | { 15 | private ApplicationDbContext _db; 16 | public ApplicationUserRepository(ApplicationDbContext db) : base(db) 17 | { 18 | _db = db; 19 | } 20 | public void Update(ApplicationUser applicationUser) 21 | { 22 | _db.ApplicationUsers.Update(applicationUser); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model Disable2faModel 3 | @{ 4 | ViewData["Title"] = "Disable two-factor authentication (2FA)"; 5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication; 6 | } 7 | 8 | 9 |

@ViewData["Title"]

10 | 11 | 20 | 21 |
22 |
23 | 24 |
25 |
26 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/User/Index.cshtml: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

User List

6 |
7 |
8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
NameEmailPhoneCompanyRole
22 | 23 |
24 |
25 | 26 | @section Scripts{ 27 | 28 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "DefaultConnection": "Server=sql.bsite.net\\MSSQL2016;Database=reyibi6159_One;User Id=reyibi6159_One;Password=9@mcatag.com;Trust Server Certificate=True;" 11 | //"DefaultConnection": "Server=.\\SQLEXPRESS; Database=BulkyNew; Trusted_Connection=true;TrustServerCertificate=true" 12 | }, 13 | "Stripe": { 14 | "SecretKey": "sk_test_51NoSrsIXgMt4IxYbF62ASFJItZ0MGiH6XhTSSUabaq8Znh6c05sCXCWnHRsKuzzP70m1MLnoQPod0lzr77i0mw7t00vA736sKj", 15 | "PublishableKey": "pk_test_51NoSrsIXgMt4IxYbBR5B6EtnhIRJhAdp1xiPCC9v5ZXTOoRixZUXC7BsBROpVK0LF0t2zzeXa3mgelQdg5bCIVPS00nYJvSjav" 16 | }, 17 | "SendGrid": { 18 | "SecretKey": "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" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ShowRecoveryCodesModel 3 | @{ 4 | ViewData["Title"] = "Recovery codes"; 5 | ViewData["ActivePage"] = "TwoFactorAuthentication"; 6 | } 7 | 8 | 9 |

@ViewData["Title"]

10 | 18 |
19 |
20 | @for (var row = 0; row < Model.RecoveryCodes.Length; row += 2) 21 | { 22 | @Model.RecoveryCodes[row] @Model.RecoveryCodes[row + 1]
23 | } 24 |
25 |
26 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/OrderDetail.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.Models 11 | { 12 | public class OrderDetail 13 | { 14 | public int Id { get; set; } 15 | [Required] 16 | public int OrderHeaderId { get; set; } 17 | [ForeignKey("OrderHeaderId")] 18 | [ValidateNever] 19 | public OrderHeader OrderHeader { get; set; } 20 | 21 | 22 | [Required] 23 | public int ProductId { get; set; } 24 | [ForeignKey("ProductId")] 25 | [ValidateNever] 26 | public Product Product { get; set; } 27 | 28 | public int Count { get; set; } 29 | public double Price { get; set; } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to Development environment will display more detailed information about the error that occurred. 20 |

21 |

22 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 23 |

24 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

26 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity; 2 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BulkyBook.Models 12 | { 13 | public class ApplicationUser: IdentityUser 14 | { 15 | [Required] 16 | public string Name { get; set; } 17 | public string? StreetAddress { get; set; } 18 | public string? City { get; set; } 19 | public string? State { get; set; } 20 | public string? PostalCode { get; set; } 21 | public int? CompanyId { get; set; } 22 | [ForeignKey("CompanyId")] 23 | [ValidateNever] 24 | public Company? Company { get; set; } 25 | [NotMapped] 26 | public string Role { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "DefaultConnection": "Server=sql.bsite.net\\MSSQL2016;Database=reyibi6159_One;User Id=reyibi6159_One;Password=9@mcatag.com;Trust Server Certificate=True;" 11 | //"DefaultConnection": "Server=sql.bsite.net\\MSSQL2016;Database=raghob_bulky;User Id=raghob_bulky;Password=xt!za8#MGf4*7r!g4;Trust Server Certificate=True;" 12 | }, 13 | "Stripe": { 14 | "SecretKey": "sk_test_51NoSrsIXgMt4IxYbF62ASFJItZ0MGiH6XhTSSUabaq8Znh6c05sCXCWnHRsKuzzP70m1MLnoQPod0lzr77i0mw7t00vA736sKj", 15 | "PublishableKey": "pk_test_51NoSrsIXgMt4IxYbBR5B6EtnhIRJhAdp1xiPCC9v5ZXTOoRixZUXC7BsBROpVK0LF0t2zzeXa3mgelQdg5bCIVPS00nYJvSjav" 16 | }, 17 | "SendGrid": { 18 | "SecretKey": "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" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | 7 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 8 | { 9 | /// 10 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 11 | /// directly from your code. This API may change or be removed in future releases. 12 | /// 13 | public class AccessDeniedModel : PageModel 14 | { 15 | /// 16 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 17 | /// directly from your code. This API may change or be removed in future releases. 18 | /// 19 | public void OnGet() 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model PersonalDataModel 3 | @{ 4 | ViewData["Title"] = "Personal Data"; 5 | ViewData["ActivePage"] = ManageNavPages.PersonalData; 6 | } 7 | 8 |

@ViewData["Title"]

9 | 10 |
11 |
12 |

Your account contains personal data that you have given us. This page allows you to download or delete that data.

13 |

14 | Deleting this data will permanently remove your account, and this cannot be recovered. 15 |

16 |
17 | 18 |
19 |

20 | Delete 21 |

22 |
23 |
24 | 25 | @section Scripts { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ResendEmailConfirmationModel 3 | @{ 4 | ViewData["Title"] = "Resend email confirmation"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

Enter your email.

9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 | 17 | 18 |
19 | 20 |
21 |
22 |
23 | 24 | @section Scripts { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ForgotPasswordModel 3 | @{ 4 | ViewData["Title"] = "Forgot your password?"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

Enter your email.

9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 | 17 | 18 |
19 | 20 |
21 |
22 |
23 | 24 | @section Scripts { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/ShoppingCart.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.Models 11 | { 12 | public class ShoppingCart 13 | { 14 | public int Id { get; set; } 15 | 16 | public int ProductId { get; set; } 17 | [ForeignKey("ProductId")] 18 | [ValidateNever] 19 | public Product Product { get; set; } 20 | [Range(1, 1000, ErrorMessage = "Please enter a value between 1 and 1000")] 21 | public int Count { get; set; } 22 | 23 | public string ApplicationUserId { get; set; } 24 | [ForeignKey("ApplicationUserId")] 25 | [ValidateNever] 26 | public ApplicationUser ApplicationUser { get; set; } 27 | 28 | [NotMapped] 29 | public double Price { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ResetAuthenticatorModel 3 | @{ 4 | ViewData["Title"] = "Reset authenticator key"; 5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication; 6 | } 7 | 8 | 9 |

@ViewData["Title"]

10 | 20 |
21 |
22 | 23 |
24 |
25 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Lockout.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc.RazorPages; 7 | 8 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 9 | { 10 | /// 11 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 12 | /// directly from your code. This API may change or be removed in future releases. 13 | /// 14 | [AllowAnonymous] 15 | public class LockoutModel : PageModel 16 | { 17 | /// 18 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 19 | /// directly from your code. This API may change or be removed in future releases. 20 | /// 21 | public void OnGet() 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/BulkyBook.DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc.RazorPages; 7 | 8 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 9 | { 10 | /// 11 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 12 | /// directly from your code. This API may change or be removed in future releases. 13 | /// 14 | [AllowAnonymous] 15 | public class ForgotPasswordConfirmation : PageModel 16 | { 17 | /// 18 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 19 | /// directly from your code. This API may change or be removed in future releases. 20 | /// 21 | public void OnGet() 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc.RazorPages; 7 | 8 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 9 | { 10 | /// 11 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 12 | /// directly from your code. This API may change or be removed in future releases. 13 | /// 14 | [AllowAnonymous] 15 | public class ResetPasswordConfirmationModel : PageModel 16 | { 17 | /// 18 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 19 | /// directly from your code. This API may change or be removed in future releases. 20 | /// 21 | public void OnGet() 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/_Layout.cshtml.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | a.navbar-brand { 5 | white-space: normal; 6 | text-align: center; 7 | word-break: break-all; 8 | } 9 | 10 | /*a { 11 | color: #0077cc; 12 | }*/ 13 | 14 | .btn-primary { 15 | color: #fff; 16 | background-color: #1b6ec2; 17 | border-color: #1861ac; 18 | } 19 | 20 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 21 | color: #fff; 22 | background-color: #1b6ec2; 23 | border-color: #1861ac; 24 | } 25 | 26 | .border-top { 27 | border-top: 1px solid #e5e5e5; 28 | } 29 | .border-bottom { 30 | border-bottom: 1px solid #e5e5e5; 31 | } 32 | 33 | .box-shadow { 34 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 35 | } 36 | 37 | button.accept-policy { 38 | font-size: 1rem; 39 | line-height: inherit; 40 | } 41 | 42 | .footer { 43 | position: absolute; 44 | bottom: 0; 45 | width: 100%; 46 | white-space: nowrap; 47 | line-height: 60px; 48 | } 49 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | 3 | @inject SignInManager SignInManager 4 | @inject UserManager UserManager 5 | 6 | 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 DEBORAJ ROY 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model GenerateRecoveryCodesModel 3 | @{ 4 | ViewData["Title"] = "Generate two-factor authentication (2FA) recovery codes"; 5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication; 6 | } 7 | 8 | 9 |

@ViewData["Title"]

10 | 23 |
24 |
25 | 26 |
27 |
28 | -------------------------------------------------------------------------------- /Bulky/Bulky.Utility/SD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BulkyBook.Utility 8 | { 9 | public static class SD 10 | { 11 | public const string Role_Customer = "Customer"; 12 | public const string Role_Company = "Company"; 13 | public const string Role_Admin = "Admin"; 14 | public const string Role_Employee = "Employee"; 15 | 16 | public const string StatusPending = "Pending"; 17 | public const string StatusApproved = "Approved"; 18 | public const string StatusInProcess = "Processing"; 19 | public const string StatusShipped = "Shipped"; 20 | public const string StatusCancelled = "Cancelled"; 21 | public const string StatusRefunded = "Refunded"; 22 | 23 | public const string PaymentStatusPending = "Pending"; 24 | public const string PaymentStatusApproved = "Approved"; 25 | public const string PaymentStatusDelayedPayment = "ApprovedForDelayedPayment"; 26 | public const string PaymentStatusRejected = "Rejected"; 27 | 28 | public const string SessionCart = "SessionShoppingCart"; 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:30320", 8 | "sslPort": 44317 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "http://localhost:5184", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "https": { 22 | "commandName": "Project", 23 | "dotnetRunMessages": true, 24 | "launchBrowser": true, 25 | "applicationUrl": "https://localhost:7031;http://localhost:5184", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | }, 30 | "IIS Express": { 31 | "commandName": "IISExpress", 32 | "launchBrowser": true, 33 | "environmentVariables": { 34 | "ASPNETCORE_ENVIRONMENT": "Development" 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Bulky/Bulky.Utility/EmailSender.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity.UI.Services; 2 | using Microsoft.Extensions.Configuration; 3 | using SendGrid.Helpers.Mail; 4 | using SendGrid; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BulkyBook.Utility 12 | { 13 | public class EmailSender : IEmailSender 14 | { 15 | public string SendGridSecret { get; set; } 16 | 17 | public EmailSender(IConfiguration _config) 18 | { 19 | SendGridSecret = _config.GetValue("SendGrid:SecretKey"); 20 | } 21 | 22 | public Task SendEmailAsync(string email, string subject, string htmlMessage) 23 | { 24 | //logic to send email 25 | 26 | var client = new SendGridClient(SendGridSecret); 27 | 28 | var from = new EmailAddress("hello@dotnetmastery.com", "Bulky Book"); 29 | var to = new EmailAddress(email); 30 | var message = MailHelper.CreateSingleEmail(from, to, subject, "", htmlMessage); 31 | 32 | return client.SendEmailAsync(message); 33 | 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Copyright OpenJS Foundation and other contributors, https://openjsf.org/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LoginWithRecoveryCodeModel 3 | @{ 4 | ViewData["Title"] = "Recovery code verification"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |

10 | You have requested to log in with a recovery code. This login will not be remembered until you provide 11 | an authenticator app code at log in or disable 2FA and log in again. 12 |

13 |
14 |
15 |
16 | 17 |
18 | 19 | 20 | 21 |
22 | 23 |
24 |
25 |
26 | 27 | @section Scripts { 28 | 29 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/lib/jquery-validation/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright Jörn Zaefferer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2021 Twitter, Inc. 4 | Copyright (c) 2011-2021 The Bootstrap Authors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) .NET Foundation and Contributors 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/_ManageNav.cshtml: -------------------------------------------------------------------------------- 1 | @inject SignInManager SignInManager 2 | @{ 3 | var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any(); 4 | } 5 | 16 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | using System; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.AspNetCore.Mvc.RazorPages; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 11 | { 12 | public class PersonalDataModel : PageModel 13 | { 14 | private readonly UserManager _userManager; 15 | private readonly ILogger _logger; 16 | 17 | public PersonalDataModel( 18 | UserManager userManager, 19 | ILogger logger) 20 | { 21 | _userManager = userManager; 22 | _logger = logger; 23 | } 24 | 25 | public async Task OnGet() 26 | { 27 | var user = await _userManager.GetUserAsync(User); 28 | if (user == null) 29 | { 30 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 31 | } 32 | 33 | return Page(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model DeletePersonalDataModel 3 | @{ 4 | ViewData["Title"] = "Delete Personal Data"; 5 | ViewData["ActivePage"] = ManageNavPages.PersonalData; 6 | } 7 | 8 |

@ViewData["Title"]

9 | 10 | 15 | 16 |
17 |
18 | 19 | @if (Model.RequirePassword) 20 | { 21 |
22 | 23 | 24 | 25 |
26 | } 27 | 28 |
29 |
30 | 31 | @section Scripts { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Company/Index.cshtml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |

Company List

7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
NameAddressCityStatePhone Number
33 | 34 |
35 |
36 | 37 | @section Scripts{ 38 | 39 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Product/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model List 2 | 3 |
4 |
5 |
6 |
7 |

Product List

8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Title ISBN Price Author Category
35 | 36 |
37 |
38 | @section Scripts{ 39 | 40 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Profile"; 5 | ViewData["ActivePage"] = ManageNavPages.Index; 6 | } 7 | 8 |

@ViewData["Title"]

9 | 10 |
11 |
12 |
13 | 14 |
15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | @section Scripts { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/ViewComponents/ShoppingCartViewComponent.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Repository.IRepository; 2 | using BulkyBook.Utility; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System.Security.Claims; 5 | 6 | namespace BulkyBookWeb.ViewComponents 7 | { 8 | public class ShoppingCartViewComponent : ViewComponent 9 | { 10 | 11 | private readonly IUnitOfWork _unitOfWork; 12 | public ShoppingCartViewComponent(IUnitOfWork unitOfWork) 13 | { 14 | _unitOfWork = unitOfWork; 15 | } 16 | 17 | public async Task InvokeAsync() 18 | { 19 | var claimsIdentity = (ClaimsIdentity)User.Identity; 20 | var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); 21 | 22 | if (claim != null) 23 | { 24 | 25 | if (HttpContext.Session.GetInt32(SD.SessionCart) == null) 26 | { 27 | HttpContext.Session.SetInt32(SD.SessionCart, 28 | _unitOfWork.ShoppingCart.GetAll(u => u.ApplicationUserId == claim.Value).Count()); 29 | } 30 | 31 | return View(HttpContext.Session.GetInt32(SD.SessionCart)); 32 | } 33 | else 34 | { 35 | HttpContext.Session.Clear(); 36 | return View(0); 37 | } 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/ProductRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class ProductRepository : Repository, IProductRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public ProductRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | public void Update(Product obj) 21 | { 22 | var objFromDb = _db.Products.FirstOrDefault(u => u.Id == obj.Id); 23 | if (objFromDb != null) 24 | { 25 | objFromDb.Title = obj.Title; 26 | objFromDb.ISBN = obj.ISBN; 27 | objFromDb.Price = obj.Price; 28 | objFromDb.Price50 = obj.Price50; 29 | objFromDb.ListPrice = obj.ListPrice; 30 | objFromDb.Price100 = obj.Price100; 31 | objFromDb.Description = obj.Description; 32 | objFromDb.CategoryId = obj.CategoryId; 33 | objFromDb.Author = obj.Author; 34 | objFromDb.ProductImages = obj.ProductImages; 35 | //if(obj.ImageUrl != null) 36 | //{ 37 | // objFromDb.ImageUrl = obj.ImageUrl; 38 | //} 39 | 40 | } 41 | 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Logout.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.Authorization; 8 | using Microsoft.AspNetCore.Identity; 9 | using Microsoft.AspNetCore.Mvc; 10 | using Microsoft.AspNetCore.Mvc.RazorPages; 11 | using Microsoft.Extensions.Logging; 12 | 13 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 14 | { 15 | public class LogoutModel : PageModel 16 | { 17 | private readonly SignInManager _signInManager; 18 | private readonly ILogger _logger; 19 | 20 | public LogoutModel(SignInManager signInManager, ILogger logger) 21 | { 22 | _signInManager = signInManager; 23 | _logger = logger; 24 | } 25 | 26 | public async Task OnPost(string returnUrl = null) 27 | { 28 | await _signInManager.SignOutAsync(); 29 | 30 | _logger.LogInformation("User logged out."); 31 | if (returnUrl != null) 32 | { 33 | return LocalRedirect(returnUrl); 34 | } 35 | else 36 | { 37 | // This needs to be a redirect so that the browser performs a new 38 | // request and the identity for the user gets updated. 39 | return RedirectToPage(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/Product.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.Models 11 | { 12 | public class Product 13 | { 14 | [Key] 15 | public int Id { get; set; } 16 | [Required] 17 | public string Title { get; set; } 18 | public string Description { get; set; } 19 | 20 | [Required] 21 | public string ISBN { get; set; } 22 | [Required] 23 | public string Author { get; set; } 24 | [Required] 25 | [Display(Name = "List Price")] 26 | [Range(1, 1000)] 27 | public double ListPrice { get; set; } 28 | 29 | 30 | [Required] 31 | [Display(Name = "Price For 1-50")] 32 | [Range(1, 1000)] 33 | public double Price { get; set; } 34 | 35 | 36 | [Required] 37 | [Display(Name = "Price For 50+")] 38 | [Range(1, 1000)] 39 | public double Price50 { get; set; } 40 | 41 | [Required] 42 | [Display(Name = "Price For 100+")] 43 | [Range(1, 1000)] 44 | public double Price100 { get; set; } 45 | 46 | public int CategoryId { get; set; } 47 | [ForeignKey("CategoryId")] 48 | [ValidateNever] 49 | public Category Category { get; set; } 50 | 51 | [ValidateNever] 52 | public List ProductImages { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/OrderHeaderRepository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class OrderHeaderRepository : Repository, IOrderHeaderRepository 13 | { 14 | private ApplicationDbContext _db; 15 | public OrderHeaderRepository(ApplicationDbContext db) : base(db) 16 | { 17 | _db = db; 18 | } 19 | 20 | 21 | 22 | public void Update(OrderHeader obj) 23 | { 24 | _db.OrderHeaders.Update(obj); 25 | } 26 | 27 | 28 | public void UpdateStatus(int id, string orderStatus, string? paymentStatus = null) 29 | { 30 | var orderFromDb = _db.OrderHeaders.FirstOrDefault(u => u.Id == id); 31 | if (orderFromDb != null) 32 | { 33 | orderFromDb.OrderStatus = orderStatus; 34 | if (!string.IsNullOrEmpty(paymentStatus)) 35 | { 36 | orderFromDb.PaymentStatus = paymentStatus; 37 | } 38 | } 39 | } 40 | 41 | public void UpdateStripePaymentID(int id, string sessionId, string paymentIntentId) 42 | { 43 | var orderFromDb = _db.OrderHeaders.FirstOrDefault(u => u.Id == id); 44 | if (!string.IsNullOrEmpty(sessionId)) 45 | { 46 | orderFromDb.SessionId = sessionId; 47 | } 48 | if (!string.IsNullOrEmpty(paymentIntentId)) 49 | { 50 | orderFromDb.PaymentIntentId = paymentIntentId; 51 | orderFromDb.PaymentDate = DateTime.Now; 52 | } 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Bulky/Bulky.Models/OrderHeader.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.Models 11 | { 12 | public class OrderHeader 13 | { 14 | public int Id { get; set; } 15 | public string ApplicationUserId { get; set; } 16 | [ForeignKey("ApplicationUserId")] 17 | [ValidateNever] 18 | public ApplicationUser ApplicationUser { get; set; } 19 | 20 | public DateTime OrderDate { get; set; } 21 | public DateTime ShippingDate { get; set; } 22 | public double OrderTotal { get; set; } 23 | 24 | public string? OrderStatus { get; set; } 25 | public string? PaymentStatus { get; set; } 26 | public string? TrackingNumber { get; set; } 27 | public string? Carrier { get; set; } 28 | 29 | public DateTime PaymentDate { get; set; } 30 | public DateTime PaymentDueDate { get; set; } 31 | 32 | public string? SessionId { get; set; } 33 | public string? PaymentIntentId { get; set; } 34 | 35 | [Required] 36 | public string PhoneNumber { get; set; } 37 | [Required] 38 | public string StreetAddress { get; set; } 39 | [Required] 40 | public string City { get; set; } 41 | [Required] 42 | public string State { get; set; } 43 | [Required] 44 | public string PostalCode { get; set; } 45 | [Required] 46 | public string Name { get; set; } 47 | 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model SetPasswordModel 3 | @{ 4 | ViewData["Title"] = "Set password"; 5 | ViewData["ActivePage"] = ManageNavPages.ChangePassword; 6 | } 7 | 8 |

Set your password

9 | 10 |

11 | You do not have a local username/password for this site. Add a local 12 | account so you can log in without an external login. 13 |

14 |
15 |
16 |
17 | 18 |
19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 |
28 | 29 |
30 |
31 |
32 | 33 | @section Scripts { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/LoginWith2fa.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LoginWith2faModel 3 | @{ 4 | ViewData["Title"] = "Two-factor authentication"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |

Your login is protected with an authenticator app. Enter your authenticator code below.

10 |
11 |
12 |
13 | 14 | 15 |
16 | 17 | 18 | 19 |
20 |
21 | 25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 |

33 | Don't have access to your authenticator device? You can 34 | log in with a recovery code. 35 |

36 | 37 | @section Scripts { 38 | 39 | } -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/UnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace BulkyBook.DataAccess.Repository 11 | { 12 | public class UnitOfWork : IUnitOfWork 13 | { 14 | private ApplicationDbContext _db; 15 | public ICategoryRepository Category { get; private set; } 16 | public ICompanyRepository Company { get; private set; } 17 | public IProductRepository Product { get; private set; } 18 | public IShoppingCartRepository ShoppingCart { get; private set; } 19 | public IApplicationUserRepository ApplicationUser { get; private set; } 20 | public IOrderHeaderRepository OrderHeader { get; private set; } 21 | public IOrderDetailRepository OrderDetail { get; private set; } 22 | public IProductImageRepository ProductImage { get; private set; } 23 | 24 | public UnitOfWork(ApplicationDbContext db) 25 | { 26 | _db = db; 27 | ProductImage = new ProductImageRepository(_db); 28 | Category = new CategoryRepository(_db); 29 | Product = new ProductRepository(_db); 30 | Company = new CompanyRepository(_db); 31 | ShoppingCart = new ShoppingCartRepository(_db); 32 | ApplicationUser = new ApplicationUserRepository(_db); 33 | OrderHeader = new OrderHeaderRepository(_db); 34 | OrderDetail = new OrderDetailRepository(_db); 35 | } 36 | 37 | public void Save() 38 | { 39 | _db.SaveChanges(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/js/order.js: -------------------------------------------------------------------------------- 1 | var dataTable; 2 | 3 | $(document).ready(function () { 4 | var url = window.location.search; 5 | if (url.includes("inprocess")) { 6 | loadDataTable("inprocess"); 7 | } 8 | else { 9 | if (url.includes("completed")) { 10 | loadDataTable("completed"); 11 | } 12 | else { 13 | if (url.includes("pending")) { 14 | loadDataTable("pending"); 15 | } 16 | else { 17 | if (url.includes("approved")) { 18 | loadDataTable("approved"); 19 | } 20 | else { 21 | loadDataTable("all"); 22 | } 23 | } 24 | } 25 | } 26 | 27 | }); 28 | 29 | function loadDataTable(status) { 30 | dataTable = $('#tblData').DataTable({ 31 | "ajax": { url: '/admin/order/getall?status=' + status }, 32 | "columns": [ 33 | { data: 'id', "width": "5%" }, 34 | { data: 'name', "width": "25%" }, 35 | { data: 'phoneNumber', "width": "20%" }, 36 | { data: 'applicationUser.email', "width": "20%" }, 37 | { data: 'orderStatus', "width": "10%" }, 38 | { data: 'orderTotal', "width": "10%" }, 39 | { 40 | data: 'id', 41 | "render": function (data) { 42 | return `
43 | 44 | 45 |
` 46 | }, 47 | "width": "10%" 48 | } 49 | ] 50 | }); 51 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/BulkyBookWeb.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | all 26 | runtime; build; native; contentfiles; analyzers; buildtransitive 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Migrations/20230927195406_addProductImageToDb.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace BulkyBook.DataAccess.Migrations 6 | { 7 | /// 8 | public partial class addProductImageToDb : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.CreateTable( 14 | name: "ProductImages", 15 | columns: table => new 16 | { 17 | Id = table.Column(type: "int", nullable: false) 18 | .Annotation("SqlServer:Identity", "1, 1"), 19 | ImageUrl = table.Column(type: "nvarchar(max)", nullable: false), 20 | ProductId = table.Column(type: "int", nullable: false) 21 | }, 22 | constraints: table => 23 | { 24 | table.PrimaryKey("PK_ProductImages", x => x.Id); 25 | table.ForeignKey( 26 | name: "FK_ProductImages_Products_ProductId", 27 | column: x => x.ProductId, 28 | principalTable: "Products", 29 | principalColumn: "Id", 30 | onDelete: ReferentialAction.Cascade); 31 | }); 32 | 33 | migrationBuilder.CreateIndex( 34 | name: "IX_ProductImages_ProductId", 35 | table: "ProductImages", 36 | column: "ProductId"); 37 | } 38 | 39 | /// 40 | protected override void Down(MigrationBuilder migrationBuilder) 41 | { 42 | migrationBuilder.DropTable( 43 | name: "ProductImages"); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/js/product.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | loadDataTable(); 3 | }); 4 | 5 | function loadDataTable() { 6 | dataTable = $('#tblData').DataTable({ 7 | "ajax": { url: '/admin/product/getall' }, 8 | "columns": [ 9 | { data: 'title', "width": "25%" }, 10 | { data: 'isbn', "width": "15%" }, 11 | { data: 'listPrice', "width": "10%" }, 12 | { data: 'author', "width": "15%" }, 13 | { data: 'category.name', "width": "10%" }, 14 | { 15 | data: 'id', 16 | "render": function (data) { 17 | return `
18 | Edit 19 | Delete 20 |
` 21 | }, 22 | "width": "25%" 23 | 24 | } 25 | ] 26 | }); 27 | } 28 | 29 | 30 | function Delete(url) { 31 | Swal.fire({ 32 | title: 'Are you sure?', 33 | text: "You won't be able to revert this!", 34 | icon: 'warning', 35 | showCancelButton: true, 36 | confirmButtonColor: '#3085d6', 37 | cancelButtonColor: '#d33', 38 | confirmButtonText: 'Yes, delete it!' 39 | }).then((result) => { 40 | if (result.isConfirmed) { 41 | $.ajax({ 42 | url: url, 43 | type: 'DELETE', 44 | success: function (data) { 45 | dataTable.ajax.reload(); 46 | toastr.success(data.message); 47 | } 48 | }) 49 | } 50 | }) 51 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ResetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ResetPasswordModel 3 | @{ 4 | ViewData["Title"] = "Reset password"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

Reset your password.

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 | @section Scripts { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System.Diagnostics; 6 | using Microsoft.AspNetCore.Authorization; 7 | using Microsoft.AspNetCore.Mvc; 8 | using Microsoft.AspNetCore.Mvc.RazorPages; 9 | 10 | namespace BulkyBookWeb.Areas.Identity.Pages 11 | { 12 | /// 13 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 14 | /// directly from your code. This API may change or be removed in future releases. 15 | /// 16 | [AllowAnonymous] 17 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 18 | public class ErrorModel : PageModel 19 | { 20 | /// 21 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 22 | /// directly from your code. This API may change or be removed in future releases. 23 | /// 24 | public string RequestId { get; set; } 25 | 26 | /// 27 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 28 | /// directly from your code. This API may change or be removed in future releases. 29 | /// 30 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 31 | 32 | /// 33 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 34 | /// directly from your code. This API may change or be removed in future releases. 35 | /// 36 | public void OnGet() 37 | { 38 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Category/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model Category 2 |
3 |
4 |
5 |
6 |

Edit Category

7 |
8 |
9 |
10 |
11 |
12 | 13 |
14 | @*
*@ 15 |
16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 |
30 | 35 |
36 | 37 | 38 |
39 |
40 |
41 |
42 | 43 | 44 | @section Scripts{ 45 | @{ 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ChangePasswordModel 3 | @{ 4 | ViewData["Title"] = "Change password"; 5 | ViewData["ActivePage"] = ManageNavPages.ChangePassword; 6 | } 7 | 8 |

@ViewData["Title"]

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 | @section Scripts { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Category/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model Category 2 | 3 |
4 |
5 |
6 |
7 |

Delete Category

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 | 40 |
41 | 42 | 43 |
44 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using Microsoft.AspNetCore.Authorization; 10 | using Microsoft.AspNetCore.Identity; 11 | using Microsoft.AspNetCore.Mvc; 12 | using Microsoft.AspNetCore.Mvc.RazorPages; 13 | using Microsoft.AspNetCore.WebUtilities; 14 | 15 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 16 | { 17 | public class ConfirmEmailModel : PageModel 18 | { 19 | private readonly UserManager _userManager; 20 | 21 | public ConfirmEmailModel(UserManager userManager) 22 | { 23 | _userManager = userManager; 24 | } 25 | 26 | /// 27 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 28 | /// directly from your code. This API may change or be removed in future releases. 29 | /// 30 | [TempData] 31 | public string StatusMessage { get; set; } 32 | public async Task OnGetAsync(string userId, string code) 33 | { 34 | if (userId == null || code == null) 35 | { 36 | return RedirectToPage("/Index"); 37 | } 38 | 39 | var user = await _userManager.FindByIdAsync(userId); 40 | if (user == null) 41 | { 42 | return NotFound($"Unable to load user with ID '{userId}'."); 43 | } 44 | 45 | code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code)); 46 | var result = await _userManager.ConfirmEmailAsync(user, code); 47 | StatusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email."; 48 | return Page(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.AspNetCore.Mvc.RazorPages; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 11 | { 12 | /// 13 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 14 | /// directly from your code. This API may change or be removed in future releases. 15 | /// 16 | public class ShowRecoveryCodesModel : PageModel 17 | { 18 | /// 19 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 20 | /// directly from your code. This API may change or be removed in future releases. 21 | /// 22 | [TempData] 23 | public string[] RecoveryCodes { get; set; } 24 | 25 | /// 26 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 27 | /// directly from your code. This API may change or be removed in future releases. 28 | /// 29 | [TempData] 30 | public string StatusMessage { get; set; } 31 | 32 | /// 33 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 34 | /// directly from your code. This API may change or be removed in future releases. 35 | /// 36 | public IActionResult OnGet() 37 | { 38 | if (RecoveryCodes == null || RecoveryCodes.Length == 0) 39 | { 40 | return RedirectToPage("./TwoFactorAuthentication"); 41 | } 42 | 43 | return Page(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Category/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model Category 2 | 3 | 4 |
5 |
6 |
7 |
8 |

Create Category

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 | 40 |
41 | 42 | 43 |
44 |
45 |
46 |
47 | 48 | 49 | @section Scripts{ 50 | @{ 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/Email.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model EmailModel 3 | @{ 4 | ViewData["Title"] = "Manage Email"; 5 | ViewData["ActivePage"] = ManageNavPages.Email; 6 | } 7 | 8 |

@ViewData["Title"]

9 | 10 |
11 |
12 |
13 | 14 | @if (Model.IsEmailConfirmed) 15 | { 16 |
17 | 18 |
19 | 20 |
21 | 22 |
23 | } 24 | else 25 | { 26 |
27 | 28 | 29 | 30 |
31 | } 32 |
33 | 34 | 35 | 36 |
37 | 38 |
39 |
40 |
41 | 42 | @section Scripts { 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/js/company.js: -------------------------------------------------------------------------------- 1 | var dataTable; 2 | 3 | 4 | 5 | 6 | $(document).ready(function () { 7 | 8 | loadDataTable(); 9 | 10 | }); 11 | 12 | 13 | 14 | 15 | function loadDataTable() { 16 | 17 | dataTable = $('#tblData').DataTable({ 18 | 19 | "ajax": { url: '/admin/company/getall' }, 20 | 21 | "columns": [ 22 | 23 | { "data": "name", "width": "15%" }, 24 | 25 | { "data": "streetAddress", "width": "15%" }, 26 | 27 | { "data": "city", "width": "15%" }, 28 | 29 | { "data": "state", "width": "15%" }, 30 | 31 | { "data": "phoneNumber", "width": "15%" }, 32 | 33 | { 34 | 35 | data: 'id', 36 | 37 | "render": function (data) { 38 | 39 | return `
40 | 41 | Edit 42 | 43 | Delete 44 | 45 |
` 46 | 47 | }, 48 | 49 | "width": "25%" 50 | 51 | } 52 | 53 | ] 54 | 55 | }); 56 | 57 | } 58 | 59 | 60 | 61 | 62 | function Delete(url) { 63 | 64 | Swal.fire({ 65 | 66 | title: 'Are you sure?', 67 | 68 | text: "You won't be able to revert this!", 69 | 70 | icon: 'warning', 71 | 72 | showCancelButton: true, 73 | 74 | confirmButtonColor: '#3085d6', 75 | 76 | cancelButtonColor: '#d33', 77 | 78 | confirmButtonText: 'Yes, delete it!' 79 | 80 | }).then((result) => { 81 | 82 | if (result.isConfirmed) { 83 | 84 | $.ajax({ 85 | 86 | url: url, 87 | 88 | type: 'DELETE', 89 | 90 | success: function (data) { 91 | 92 | dataTable.ajax.reload(); 93 | 94 | toastr.success(data.message); 95 | 96 | } 97 | 98 | }) 99 | 100 | } 101 | 102 | }) 103 | 104 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Category/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model List 2 | 3 |
4 |
5 |
6 |
7 |

Category List

8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 20 |
21 | 22 | 23 | 24 | 25 | 28 | 31 | 32 | 33 | 34 | 35 | @foreach (var obj in Model.OrderBy(u => u.DisplayOrder)) 36 | { 37 | 38 | 39 | 42 | 52 | 53 | } 54 | 55 |
26 | Category Name 27 | 29 | Display Order 30 |
@obj.Name 40 | @obj.DisplayOrder 41 | 43 | 51 |
56 | 57 |
58 |
-------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ExternalLoginsModel 3 | @{ 4 | ViewData["Title"] = "Manage your external logins"; 5 | ViewData["ActivePage"] = ManageNavPages.ExternalLogins; 6 | } 7 | 8 | 9 | @if (Model.CurrentLogins?.Count > 0) 10 | { 11 |

Registered Logins

12 | 13 | 14 | @foreach (var login in Model.CurrentLogins) 15 | { 16 | 17 | 18 | 34 | 35 | } 36 | 37 |
@login.ProviderDisplayName 19 | @if (Model.ShowRemoveButton) 20 | { 21 |
22 |
23 | 24 | 25 | 26 |
27 |
28 | } 29 | else 30 | { 31 | @:   32 | } 33 |
38 | } 39 | @if (Model.OtherLogins?.Count > 0) 40 | { 41 |

Add another service to log in.

42 |
43 | 53 | } 54 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 |
4 | @foreach (var product in Model) 5 | { 6 |
7 |
8 |
9 |
10 | 11 | @if (product.ProductImages != null && product.ProductImages.Count() > 0) 12 | { 13 | 14 | } 15 | else 16 | { 17 | 18 | } 19 | 20 |
21 |
22 |

@product.Title

23 |

by @product.Author

24 |
25 |
26 |

27 | List Price: 28 | 29 | @product.ListPrice.ToString("c") 30 | 31 |

32 |
33 |
34 |

35 | As low as: 36 | 37 | @product.Price100.ToString("c") 38 | 39 |

40 |
41 |
42 | 49 |
50 |
51 |
52 |
53 | } 54 |
-------------------------------------------------------------------------------- /Bulky/Bulky.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.7.33913.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkyBookWeb", "BulkyWeb\BulkyBookWeb.csproj", "{78E77AE9-CE12-4246-88E0-ED75B503344F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkyBook.DataAccess", "Bulky.DataAccess\BulkyBook.DataAccess.csproj", "{2AA1E303-B00E-4997-B270-E9F2AA86D1E8}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkyBook.Models", "Bulky.Models\BulkyBook.Models.csproj", "{2F061E16-2719-43C0-9B39-C0C146819529}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkyBook.Utility", "Bulky.Utility\BulkyBook.Utility.csproj", "{F89BBE29-4E2E-4655-A23B-E07E5C1107F2}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {78E77AE9-CE12-4246-88E0-ED75B503344F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {78E77AE9-CE12-4246-88E0-ED75B503344F}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {78E77AE9-CE12-4246-88E0-ED75B503344F}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {78E77AE9-CE12-4246-88E0-ED75B503344F}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {2AA1E303-B00E-4997-B270-E9F2AA86D1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {2AA1E303-B00E-4997-B270-E9F2AA86D1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {2AA1E303-B00E-4997-B270-E9F2AA86D1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {2AA1E303-B00E-4997-B270-E9F2AA86D1E8}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {2F061E16-2719-43C0-9B39-C0C146819529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {2F061E16-2719-43C0-9B39-C0C146819529}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {2F061E16-2719-43C0-9B39-C0C146819529}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {2F061E16-2719-43C0-9B39-C0C146819529}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {F89BBE29-4E2E-4655-A23B-E07E5C1107F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {F89BBE29-4E2E-4655-A23B-E07E5C1107F2}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {F89BBE29-4E2E-4655-A23B-E07E5C1107F2}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {F89BBE29-4E2E-4655-A23B-E07E5C1107F2}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {1743A6D6-7AD9-43BE-AF97-9CAF825E5BF4} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Text.Json; 10 | using System.Threading.Tasks; 11 | using Microsoft.AspNetCore.Identity; 12 | using Microsoft.AspNetCore.Mvc; 13 | using Microsoft.AspNetCore.Mvc.RazorPages; 14 | using Microsoft.Extensions.Logging; 15 | 16 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 17 | { 18 | public class DownloadPersonalDataModel : PageModel 19 | { 20 | private readonly UserManager _userManager; 21 | private readonly ILogger _logger; 22 | 23 | public DownloadPersonalDataModel( 24 | UserManager userManager, 25 | ILogger logger) 26 | { 27 | _userManager = userManager; 28 | _logger = logger; 29 | } 30 | 31 | public IActionResult OnGet() 32 | { 33 | return NotFound(); 34 | } 35 | 36 | public async Task OnPostAsync() 37 | { 38 | var user = await _userManager.GetUserAsync(User); 39 | if (user == null) 40 | { 41 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 42 | } 43 | 44 | _logger.LogInformation("User with ID '{UserId}' asked for their personal data.", _userManager.GetUserId(User)); 45 | 46 | // Only include personal data for download 47 | var personalData = new Dictionary(); 48 | var personalDataProps = typeof(IdentityUser).GetProperties().Where( 49 | prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute))); 50 | foreach (var p in personalDataProps) 51 | { 52 | personalData.Add(p.Name, p.GetValue(user)?.ToString() ?? "null"); 53 | } 54 | 55 | var logins = await _userManager.GetLoginsAsync(user); 56 | foreach (var l in logins) 57 | { 58 | personalData.Add($"{l.LoginProvider} external login provider key", l.ProviderKey); 59 | } 60 | 61 | personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user)); 62 | 63 | Response.Headers.TryAdd("Content-Disposition", "attachment; filename=PersonalData.json"); 64 | return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Repository/Repository.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using Microsoft.EntityFrameworkCore; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BulkyBook.DataAccess.Repository 12 | { 13 | public class Repository : IRepository where T : class 14 | { 15 | private readonly ApplicationDbContext _db; 16 | internal DbSet dbSet; 17 | public Repository(ApplicationDbContext db) 18 | { 19 | _db = db; 20 | this.dbSet = _db.Set(); 21 | //_db.Categories == dbSet 22 | _db.Products.Include(u => u.Category).Include(u => u.CategoryId); 23 | } 24 | public void Add(T entity) 25 | { 26 | dbSet.Add(entity); 27 | } 28 | 29 | public T Get(Expression> filter, string? includeProperties = null, bool tracked = false) 30 | { 31 | IQueryable query; 32 | if (tracked) 33 | { 34 | query = dbSet; 35 | 36 | } 37 | else 38 | { 39 | query = dbSet.AsNoTracking(); 40 | } 41 | 42 | query = query.Where(filter); 43 | if (!string.IsNullOrEmpty(includeProperties)) 44 | { 45 | foreach (var includeProp in includeProperties 46 | .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) 47 | { 48 | query = query.Include(includeProp); 49 | } 50 | } 51 | return query.FirstOrDefault(); 52 | } 53 | 54 | public IEnumerable GetAll(Expression>? filter = null, string? includeProperties = null) 55 | { 56 | IQueryable query = dbSet; 57 | if (filter != null) 58 | { 59 | query = query.Where(filter); 60 | } 61 | 62 | if (!string.IsNullOrEmpty(includeProperties)) 63 | { 64 | foreach (var includeProp in includeProperties 65 | .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) 66 | { 67 | query = query.Include(includeProp); 68 | } 69 | } 70 | return query.ToList(); 71 | } 72 | 73 | public void Remove(T entity) 74 | { 75 | dbSet.Remove(entity); 76 | } 77 | 78 | public void RemoveRange(IEnumerable entities) 79 | { 80 | dbSet.RemoveRange(entities); 81 | } 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model EnableAuthenticatorModel 3 | @{ 4 | ViewData["Title"] = "Configure authenticator app"; 5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication; 6 | } 7 | 8 | 9 |

@ViewData["Title"]

10 |
11 |

To use an authenticator app go through the following steps:

12 |
    13 |
  1. 14 |

    15 | Download a two-factor authenticator app like Microsoft Authenticator for 16 | Android and 17 | iOS or 18 | Google Authenticator for 19 | Android and 20 | iOS. 21 |

    22 |
  2. 23 |
  3. 24 |

    Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.

    25 | 26 |
    27 |
    28 |
  4. 29 |
  5. 30 |

    31 | Once you have scanned the QR code or input the key above, your two factor authentication app will provide you 32 | with a unique code. Enter the code in the confirmation box below. 33 |

    34 |
    35 |
    36 |
    37 |
    38 | 39 | 40 | 41 |
    42 | 43 | 44 |
    45 |
    46 |
    47 |
  6. 48 |
49 |
50 | 51 | @section Scripts { 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.Identity; 8 | using Microsoft.AspNetCore.Mvc; 9 | using Microsoft.AspNetCore.Mvc.RazorPages; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 13 | { 14 | public class Disable2faModel : PageModel 15 | { 16 | private readonly UserManager _userManager; 17 | private readonly ILogger _logger; 18 | 19 | public Disable2faModel( 20 | UserManager userManager, 21 | ILogger logger) 22 | { 23 | _userManager = userManager; 24 | _logger = logger; 25 | } 26 | 27 | /// 28 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 29 | /// directly from your code. This API may change or be removed in future releases. 30 | /// 31 | [TempData] 32 | public string StatusMessage { get; set; } 33 | 34 | public async Task OnGet() 35 | { 36 | var user = await _userManager.GetUserAsync(User); 37 | if (user == null) 38 | { 39 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 40 | } 41 | 42 | if (!await _userManager.GetTwoFactorEnabledAsync(user)) 43 | { 44 | throw new InvalidOperationException($"Cannot disable 2FA for user as it's not currently enabled."); 45 | } 46 | 47 | return Page(); 48 | } 49 | 50 | public async Task OnPostAsync() 51 | { 52 | var user = await _userManager.GetUserAsync(User); 53 | if (user == null) 54 | { 55 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 56 | } 57 | 58 | var disable2faResult = await _userManager.SetTwoFactorEnabledAsync(user, false); 59 | if (!disable2faResult.Succeeded) 60 | { 61 | throw new InvalidOperationException($"Unexpected error occurred disabling 2FA."); 62 | } 63 | 64 | _logger.LogInformation("User with ID '{UserId}' has disabled 2fa.", _userManager.GetUserId(User)); 65 | StatusMessage = "2fa has been disabled. You can reenable 2fa when you setup an authenticator app"; 66 | return RedirectToPage("./TwoFactorAuthentication"); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.Identity; 8 | using Microsoft.AspNetCore.Mvc; 9 | using Microsoft.AspNetCore.Mvc.RazorPages; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 13 | { 14 | public class ResetAuthenticatorModel : PageModel 15 | { 16 | private readonly UserManager _userManager; 17 | private readonly SignInManager _signInManager; 18 | private readonly ILogger _logger; 19 | 20 | public ResetAuthenticatorModel( 21 | UserManager userManager, 22 | SignInManager signInManager, 23 | ILogger logger) 24 | { 25 | _userManager = userManager; 26 | _signInManager = signInManager; 27 | _logger = logger; 28 | } 29 | 30 | /// 31 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 32 | /// directly from your code. This API may change or be removed in future releases. 33 | /// 34 | [TempData] 35 | public string StatusMessage { get; set; } 36 | 37 | public async Task OnGet() 38 | { 39 | var user = await _userManager.GetUserAsync(User); 40 | if (user == null) 41 | { 42 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 43 | } 44 | 45 | return Page(); 46 | } 47 | 48 | public async Task OnPostAsync() 49 | { 50 | var user = await _userManager.GetUserAsync(User); 51 | if (user == null) 52 | { 53 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 54 | } 55 | 56 | await _userManager.SetTwoFactorEnabledAsync(user, false); 57 | await _userManager.ResetAuthenticatorKeyAsync(user); 58 | var userId = await _userManager.GetUserIdAsync(user); 59 | _logger.LogInformation("User with ID '{UserId}' has reset their authentication app key.", user.Id); 60 | 61 | await _signInManager.RefreshSignInAsync(user); 62 | StatusMessage = "Your authenticator app key has been reset, you will need to configure your authenticator app using the new key."; 63 | 64 | return RedirectToPage("./EnableAuthenticator"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ASP.NET Core MVC - E-commerce Project [.NET 8] 2 | 3 | This repository contains code and resources for the **.NET Core MVC - The Complete Guide 2023 [E-commerce]** course available on [Udemy](https://www.udemy.com/course/complete-aspnet-core-21-course/). The course focuses on building a real-world e-commerce application using ASP.NET Core MVC, Entity Framework Core, and ASP.NET Core Identity. 4 | 5 | ## Course Overview 6 | 7 | - **Course Description**: Build a comprehensive e-commerce application leveraging ASP.NET Core MVC, Entity Framework Core, and ASP.NET Core Identity. 8 | - **YouTube Introduction**: [Introduction to ASP.NET Core MVC (.NET 8)](https://www.youtube.com/watch?v=AopeJjkcRvU) 9 | - **Description**: The introductory video provides insights into the MVC (Model-View-Controller) structure in .NET 8. 10 | 11 | ## Key Learning Objectives 12 | 13 | - Understand the structure of ASP.NET Core MVC (.NET 8) and Razor Project 14 | - Learn essential fundamentals of ASP.NET MVC Core (.NET 8) 15 | - Build projects during the course 16 | - Integrate Identity Framework, add additional user fields, and work with Razor class library for Identity 17 | - Implement Entity Framework and code-first migrations 18 | - Explore sessions, custom tag helpers, view components, and partial views in ASP.NET Core 19 | - Utilize Bootstrap v5 for UI development 20 | - Implement authentication, authorization, and social login (Google, Facebook) 21 | - Manage roles within ASP.NET Core Identity 22 | - Implement email notifications, handle TempData, and integrate Stripe payment 23 | - Apply Repository Pattern for database access and automate seed database migrations 24 | - Deployment on Microsoft Azure 25 | 26 | ## Course Structure 27 | 28 | The course delves into fundamental concepts and gradually progresses towards building a more complex MVC application. It covers MVC and Razor Pages, exploring their functionalities and enhancements. 29 | 30 | ## Additional Resources 31 | 32 | - **Full Course [17hr+ content]**: [DotNetMastery](https://www.dotnetmastery.com/Home/Details?courseId=9) 33 | - **GitHub Repositories**: 34 | - [Bulky_MVC](https://github.com/bhrugen/Bulky_MVC/) 35 | - [Other Repositories](https://github.com/bhrugen) 36 | 37 | ## Live Project 38 | 39 | Check out the live version of the (E-Commerce App) ASP.NET MVC project: 40 | 41 | [E-Commerce App Link 1](https://plumwillyt.bsite.net/) 42 | Or 43 | [E-Commerce App Link 2](https://bookstoredeb.runasp.net/) 44 | 45 | ## Section Breakdown (Timestamps) 46 | 47 | Due to the extensive content, a section-wise breakdown is available within the course for easy navigation and reference. 48 | 49 | --- 50 | 51 | Feel free to add more details, badges, or any other relevant information specific to your repository or the course content. This README aims to provide a comprehensive overview of the course and the associated repository. 52 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Microsoft.AspNetCore.Authorization; 9 | using Microsoft.AspNetCore.Identity; 10 | using Microsoft.AspNetCore.Mvc; 11 | using Microsoft.AspNetCore.Mvc.RazorPages; 12 | using Microsoft.AspNetCore.WebUtilities; 13 | 14 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 15 | { 16 | public class ConfirmEmailChangeModel : PageModel 17 | { 18 | private readonly UserManager _userManager; 19 | private readonly SignInManager _signInManager; 20 | 21 | public ConfirmEmailChangeModel(UserManager userManager, SignInManager signInManager) 22 | { 23 | _userManager = userManager; 24 | _signInManager = signInManager; 25 | } 26 | 27 | /// 28 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 29 | /// directly from your code. This API may change or be removed in future releases. 30 | /// 31 | [TempData] 32 | public string StatusMessage { get; set; } 33 | 34 | public async Task OnGetAsync(string userId, string email, string code) 35 | { 36 | if (userId == null || email == null || code == null) 37 | { 38 | return RedirectToPage("/Index"); 39 | } 40 | 41 | var user = await _userManager.FindByIdAsync(userId); 42 | if (user == null) 43 | { 44 | return NotFound($"Unable to load user with ID '{userId}'."); 45 | } 46 | 47 | code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code)); 48 | var result = await _userManager.ChangeEmailAsync(user, email, code); 49 | if (!result.Succeeded) 50 | { 51 | StatusMessage = "Error changing email."; 52 | return Page(); 53 | } 54 | 55 | // In our UI email and user name are one and the same, so when we update the email 56 | // we need to update the user name. 57 | var setUserNameResult = await _userManager.SetUserNameAsync(user, email); 58 | if (!setUserNameResult.Succeeded) 59 | { 60 | StatusMessage = "Error changing user name."; 61 | return Page(); 62 | } 63 | 64 | await _signInManager.RefreshSignInAsync(user); 65 | StatusMessage = "Thank you for confirming your email change."; 66 | return Page(); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/User/RoleManagment.cshtml: -------------------------------------------------------------------------------- 1 | @model RoleManagmentVM 2 | 3 |
4 |
5 |
6 |
7 |

Manage User Role

8 |
9 |
10 |
11 |
12 |
13 | 14 |
15 | @*
*@ 16 |
17 | 18 | 19 |
20 |
21 | 22 |
23 | @{ 24 | var companyVisible = "display:none;"; 25 | } 26 | @if (Model.ApplicationUser.Role == SD.Role_Company) 27 | { 28 | companyVisible = "display:block;"; 29 | } 30 |
31 | 33 |
34 | 35 |
36 |
37 | 38 |
39 | 44 |
45 |
46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 | @section Scripts{ 54 | @{ 55 | 56 | } 57 | 70 | } -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/DbInitializer/DbInitializer.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.Models; 3 | using BulkyBook.Utility; 4 | using Microsoft.AspNetCore.Identity; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace BulkyBook.DataAccess.DbInitializer 13 | { 14 | public class DbInitializer : IDbInitializer 15 | { 16 | private readonly UserManager _userManager; 17 | private readonly RoleManager _roleManager; 18 | private readonly ApplicationDbContext _db; 19 | 20 | public DbInitializer( 21 | UserManager userManager, 22 | RoleManager roleManager, 23 | ApplicationDbContext db) 24 | { 25 | _roleManager = roleManager; 26 | _userManager = userManager; 27 | _db = db; 28 | } 29 | 30 | 31 | public void Initialize() 32 | { 33 | 34 | 35 | //migrations if they are not applied 36 | try 37 | { 38 | if (_db.Database.GetPendingMigrations().Count() > 0) 39 | { 40 | _db.Database.Migrate(); 41 | } 42 | } 43 | catch (Exception ex) { } 44 | 45 | 46 | 47 | //create roles if they are not created 48 | if (!_roleManager.RoleExistsAsync(SD.Role_Customer).GetAwaiter().GetResult()) 49 | { 50 | _roleManager.CreateAsync(new IdentityRole(SD.Role_Customer)).GetAwaiter().GetResult(); 51 | _roleManager.CreateAsync(new IdentityRole(SD.Role_Employee)).GetAwaiter().GetResult(); 52 | _roleManager.CreateAsync(new IdentityRole(SD.Role_Admin)).GetAwaiter().GetResult(); 53 | _roleManager.CreateAsync(new IdentityRole(SD.Role_Company)).GetAwaiter().GetResult(); 54 | 55 | 56 | //if roles are not created, then we will create admin user as well 57 | _userManager.CreateAsync(new ApplicationUser 58 | { 59 | UserName = "admin@dotnet.com", 60 | Email = "admin@dotnet.com", 61 | Name = "DEBORAJ ROY", 62 | PhoneNumber = "01708119559", 63 | StreetAddress = "VIKTORIA 123 Ave", 64 | State = "DK", 65 | PostalCode = "23422", 66 | City = "DHAKA" 67 | }, "Admin@123*").GetAwaiter().GetResult(); 68 | 69 | 70 | ApplicationUser user = _db.ApplicationUsers.FirstOrDefault(u => u.Email == "admin@dotnet.com"); 71 | _userManager.AddToRoleAsync(user, SD.Role_Admin).GetAwaiter().GetResult(); 72 | 73 | } 74 | 75 | return; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/js/user.js: -------------------------------------------------------------------------------- 1 | 2 | var dataTable; 3 | 4 | $(document).ready(function () { 5 | loadDataTable(); 6 | }); 7 | 8 | function loadDataTable() { 9 | dataTable = $('#tblData').DataTable({ 10 | "ajax": { url: '/admin/user/getall' }, 11 | "columns": [ 12 | { "data": "name", "width": "15%" }, 13 | { "data": "email", "width": "15%" }, 14 | { "data": "phoneNumber", "width": "15%" }, 15 | { "data": "company.name", "width": "15%" }, 16 | { "data": "role", "width": "15%" }, 17 | { 18 | data: { id: "id", lockoutEnd: "lockoutEnd" }, 19 | "render": function (data) { 20 | var today = new Date().getTime(); 21 | var lockout = new Date(data.lockoutEnd).getTime(); 22 | 23 | if (lockout > today) { 24 | return ` 25 | 33 | ` 34 | } 35 | else { 36 | return ` 37 | 45 | ` 46 | } 47 | }, 48 | "width": "25%" 49 | } 50 | ] 51 | }); 52 | } 53 | 54 | 55 | 56 | function LockUnlock(id) { 57 | 58 | $.ajax({ 59 | 60 | type: "POST", 61 | 62 | url: '/Admin/User/LockUnlock', 63 | 64 | data: JSON.stringify(id), 65 | 66 | contentType: "application/json", 67 | 68 | success: function (data) { 69 | 70 | if (data.success) { 71 | 72 | toastr.success(data.message); 73 | 74 | dataTable.ajax.reload(); 75 | 76 | } 77 | 78 | } 79 | 80 | }); 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Bulky/Bulky.DataAccess/Migrations/20230927194726_removeImageUrl.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace BulkyBook.DataAccess.Migrations 6 | { 7 | /// 8 | public partial class removeImageUrl : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.DropColumn( 14 | name: "ImageUrl", 15 | table: "Products"); 16 | 17 | migrationBuilder.DropColumn( 18 | name: "TestProperty", 19 | table: "Products"); 20 | } 21 | 22 | /// 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.AddColumn( 26 | name: "ImageUrl", 27 | table: "Products", 28 | type: "nvarchar(max)", 29 | nullable: false, 30 | defaultValue: ""); 31 | 32 | migrationBuilder.AddColumn( 33 | name: "TestProperty", 34 | table: "Products", 35 | type: "int", 36 | nullable: false, 37 | defaultValue: 0); 38 | 39 | migrationBuilder.UpdateData( 40 | table: "Products", 41 | keyColumn: "Id", 42 | keyValue: 1, 43 | columns: new[] { "ImageUrl", "TestProperty" }, 44 | values: new object[] { "", 0 }); 45 | 46 | migrationBuilder.UpdateData( 47 | table: "Products", 48 | keyColumn: "Id", 49 | keyValue: 2, 50 | columns: new[] { "ImageUrl", "TestProperty" }, 51 | values: new object[] { "", 0 }); 52 | 53 | migrationBuilder.UpdateData( 54 | table: "Products", 55 | keyColumn: "Id", 56 | keyValue: 3, 57 | columns: new[] { "ImageUrl", "TestProperty" }, 58 | values: new object[] { "", 0 }); 59 | 60 | migrationBuilder.UpdateData( 61 | table: "Products", 62 | keyColumn: "Id", 63 | keyValue: 4, 64 | columns: new[] { "ImageUrl", "TestProperty" }, 65 | values: new object[] { "", 0 }); 66 | 67 | migrationBuilder.UpdateData( 68 | table: "Products", 69 | keyColumn: "Id", 70 | keyValue: 5, 71 | columns: new[] { "ImageUrl", "TestProperty" }, 72 | values: new object[] { "", 0 }); 73 | 74 | migrationBuilder.UpdateData( 75 | table: "Products", 76 | keyColumn: "Id", 77 | keyValue: 6, 78 | columns: new[] { "ImageUrl", "TestProperty" }, 79 | values: new object[] { "", 0 }); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @using Microsoft.AspNetCore.Http.Features 3 | @model TwoFactorAuthenticationModel 4 | @{ 5 | ViewData["Title"] = "Two-factor authentication (2FA)"; 6 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication; 7 | } 8 | 9 | 10 |

@ViewData["Title"]

11 | @{ 12 | var consentFeature = HttpContext.Features.Get(); 13 | @if (consentFeature?.CanTrack ?? true) 14 | { 15 | @if (Model.Is2faEnabled) 16 | { 17 | if (Model.RecoveryCodesLeft == 0) 18 | { 19 |
20 | You have no recovery codes left. 21 |

You must generate a new set of recovery codes before you can log in with a recovery code.

22 |
23 | } 24 | else if (Model.RecoveryCodesLeft == 1) 25 | { 26 |
27 | You have 1 recovery code left. 28 |

You can generate a new set of recovery codes.

29 |
30 | } 31 | else if (Model.RecoveryCodesLeft <= 3) 32 | { 33 |
34 | You have @Model.RecoveryCodesLeft recovery codes left. 35 |

You should generate a new set of recovery codes.

36 |
37 | } 38 | 39 | if (Model.IsMachineRemembered) 40 | { 41 |
42 | 43 |
44 | } 45 | Disable 2FA 46 | Reset recovery codes 47 | } 48 | 49 |

Authenticator app

50 | @if (!Model.HasAuthenticator) 51 | { 52 | Add authenticator app 53 | } 54 | else 55 | { 56 | Set up authenticator app 57 | Reset authenticator app 58 | } 59 | } 60 | else 61 | { 62 |
63 | Privacy and cookie policy have not been accepted. 64 |

You must accept the policy before you can enable two factor authentication.

65 |
66 | } 67 | } 68 | 69 | @section Scripts { 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Views/Order/Index.cshtml: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | var status = Context.Request.Query["status"]; 4 | var pending = "text-primary"; 5 | var inprocess = "text-primary"; 6 | var completed = "text-primary"; 7 | var approved = "text-primary"; 8 | var all = "text-primary"; 9 | 10 | switch (status) 11 | { 12 | case "pending": 13 | pending = "active text-white bg-primary"; 14 | break; 15 | case "inprocess": 16 | inprocess = "active text-white bg-primary"; 17 | break; 18 | case "completed": 19 | completed = "active text-white bg-primary"; 20 | break; 21 | case "approved": 22 | approved = "active text-white bg-primary"; 23 | break; 24 | default: 25 | all = "active text-white bg-primary"; 26 | break; 27 | 28 | } 29 | 30 | } 31 | 32 | 33 |
34 |
35 |
36 |
37 |

Order List

38 |
39 |
40 |
41 |
42 | 43 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
IDNamePhone NumberEmailStatusTotal
77 | 78 |
79 |
80 | 81 | @section Scripts{ 82 | 83 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Customer/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Repository.IRepository; 2 | using BulkyBook.Models; 3 | using BulkyBook.Utility; 4 | using Microsoft.AspNetCore.Authorization; 5 | using Microsoft.AspNetCore.Http; 6 | using Microsoft.AspNetCore.Mvc; 7 | using System.Diagnostics; 8 | using System.Security.Claims; 9 | 10 | namespace BulkyBookWeb.Areas.Customer.Controllers 11 | { 12 | [Area("Customer")] 13 | public class HomeController : Controller 14 | { 15 | private readonly ILogger _logger; 16 | private readonly IUnitOfWork _unitOfWork; 17 | 18 | public HomeController(ILogger logger, IUnitOfWork unitOfWork) 19 | { 20 | _logger = logger; 21 | _unitOfWork = unitOfWork; 22 | } 23 | 24 | public IActionResult Index() 25 | { 26 | IEnumerable productList = _unitOfWork.Product.GetAll(includeProperties: "Category,ProductImages"); 27 | return View(productList); 28 | } 29 | 30 | public IActionResult Details(int productId) 31 | { 32 | ShoppingCart cart = new() 33 | { 34 | 35 | Product = _unitOfWork.Product.Get(u => u.Id == productId, includeProperties: "Category,ProductImages"), 36 | Count = 1, 37 | ProductId = productId 38 | 39 | }; 40 | return View(cart); 41 | } 42 | 43 | [HttpPost] 44 | [Authorize] 45 | public IActionResult Details(ShoppingCart shoppingCart) 46 | { 47 | var claimsIdentity = (ClaimsIdentity)User.Identity; 48 | var userId = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier).Value; 49 | shoppingCart.ApplicationUserId = userId; 50 | ShoppingCart cartFromDb = _unitOfWork.ShoppingCart.Get(u => u.ApplicationUserId == userId && 51 | u.ProductId == shoppingCart.ProductId); 52 | if (cartFromDb != null) 53 | { 54 | //shopping cart exists 55 | cartFromDb.Count += shoppingCart.Count; 56 | _unitOfWork.ShoppingCart.Update(cartFromDb); 57 | _unitOfWork.Save(); 58 | } 59 | else 60 | { 61 | //add cart record 62 | _unitOfWork.ShoppingCart.Add(shoppingCart); 63 | _unitOfWork.Save(); 64 | HttpContext.Session.SetInt32(SD.SessionCart, 65 | _unitOfWork.ShoppingCart.GetAll(u => u.ApplicationUserId == userId).Count()); 66 | } 67 | TempData["success"] = "Cart updated successfully"; 68 | 69 | 70 | 71 | return RedirectToAction(nameof(Index)); 72 | } 73 | 74 | public IActionResult Privacy() 75 | { 76 | return View(); 77 | } 78 | 79 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 80 | public IActionResult Error() 81 | { 82 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Program.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.DataAccess.Repository; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.AspNetCore.Identity.UI.Services; 7 | using BulkyBook.Utility; 8 | using Stripe; 9 | using BulkyBook.DataAccess.DbInitializer; 10 | using System.Xml.Linq; 11 | 12 | var builder = WebApplication.CreateBuilder(args); 13 | 14 | // Add services to the container. 15 | builder.Services.AddControllersWithViews(); 16 | builder.Services.AddDbContext(options => 17 | options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); 18 | 19 | builder.Services.Configure(builder.Configuration.GetSection("Stripe")); 20 | 21 | builder.Services.AddIdentity().AddEntityFrameworkStores().AddDefaultTokenProviders(); 22 | 23 | builder.Services.ConfigureApplicationCookie(options => 24 | { 25 | options.LoginPath = $"/Identity/Account/Login"; 26 | options.LogoutPath = $"/Identity/Account/Logout"; 27 | options.AccessDeniedPath = $"/Identity/Account/AccessDenied"; 28 | }); 29 | 30 | builder.Services.AddAuthentication().AddFacebook(option => 31 | { 32 | option.AppId = "330839992733980"; 33 | option.AppSecret = "7a7db721e666c19bf802048d4d3eb0bc"; 34 | }); 35 | 36 | builder.Services.AddAuthentication().AddMicrosoftAccount(option => { 37 | option.ClientId = "6375b4c1-e35c-42fc-b753-0001e33a0002"; 38 | option.ClientSecret = "s-T8Q~YszVhUHW5-aPtEhBAzIyP9DU.5m3pwnbFB"; 39 | }); 40 | 41 | builder.Services.AddDistributedMemoryCache(); 42 | builder.Services.AddSession(options => 43 | { 44 | options.IdleTimeout = TimeSpan.FromMinutes(100); 45 | options.Cookie.HttpOnly = true; 46 | options.Cookie.IsEssential = true; 47 | }); 48 | 49 | builder.Services.AddScoped(); 50 | builder.Services.AddRazorPages(); 51 | builder.Services.AddScoped(); 52 | builder.Services.AddScoped(); 53 | 54 | 55 | 56 | var app = builder.Build(); 57 | 58 | // Configure the HTTP request pipeline. 59 | if (!app.Environment.IsDevelopment()) 60 | { 61 | app.UseExceptionHandler("/Home/Error"); 62 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 63 | app.UseHsts(); 64 | } 65 | 66 | app.UseHttpsRedirection(); 67 | app.UseStaticFiles(); 68 | 69 | StripeConfiguration.ApiKey = builder.Configuration.GetSection("Stripe:SecretKey").Get(); 70 | 71 | app.UseRouting(); 72 | app.UseAuthentication(); 73 | app.UseAuthorization(); 74 | app.UseSession(); 75 | SeedDatabase(); 76 | app.MapRazorPages(); 77 | app.MapControllerRoute( 78 | name: "default", 79 | pattern: "{area=Customer}/{controller=Home}/{action=Index}/{id?}"); 80 | 81 | app.Run(); 82 | 83 | void SeedDatabase() 84 | { 85 | using (var scope = app.Services.CreateScope()) 86 | { 87 | var dbInitializer = scope.ServiceProvider.GetRequiredService(); 88 | dbInitializer.Initialize(); 89 | } 90 | } -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Controllers/CompanyController.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using BulkyBook.Models.ViewModels; 5 | using BulkyBook.Utility; 6 | using Microsoft.AspNetCore.Authorization; 7 | using Microsoft.AspNetCore.Mvc; 8 | using Microsoft.AspNetCore.Mvc.Rendering; 9 | using Microsoft.DotNet.Scaffolding.Shared.Messaging; 10 | using System.Collections.Generic; 11 | 12 | namespace BulkyBookWeb.Areas.Admin.Controllers 13 | { 14 | [Area("Admin")] 15 | [Authorize(Roles = SD.Role_Admin)] 16 | 17 | public class CompanyController : Controller 18 | { 19 | private readonly IUnitOfWork _unitOfWork; 20 | public CompanyController(IUnitOfWork unitOfWork) 21 | { 22 | _unitOfWork = unitOfWork; 23 | } 24 | public IActionResult Index() 25 | { 26 | List objCompanyList = _unitOfWork.Company.GetAll().ToList(); 27 | 28 | return View(objCompanyList); 29 | } 30 | 31 | public IActionResult Upsert(int? id) 32 | { 33 | 34 | if (id == null || id == 0) 35 | { 36 | //create 37 | return View(new Company()); 38 | } 39 | else 40 | { 41 | //update 42 | Company companyObj = _unitOfWork.Company.Get(u => u.Id == id); 43 | return View(companyObj); 44 | } 45 | 46 | } 47 | [HttpPost] 48 | public IActionResult Upsert(Company CompanyObj) 49 | { 50 | if (ModelState.IsValid) 51 | { 52 | 53 | if (CompanyObj.Id == 0) 54 | { 55 | _unitOfWork.Company.Add(CompanyObj); 56 | TempData["success"] = "Company created successfully"; 57 | } 58 | else 59 | { 60 | _unitOfWork.Company.Update(CompanyObj); 61 | TempData["success"] = "Company Updated successfully"; 62 | } 63 | 64 | _unitOfWork.Save(); 65 | return RedirectToAction("Index"); 66 | } 67 | else 68 | { 69 | 70 | return View(CompanyObj); 71 | } 72 | } 73 | 74 | 75 | #region API CALLS 76 | 77 | [HttpGet] 78 | public IActionResult GetAll() 79 | { 80 | List objCompanyList = _unitOfWork.Company.GetAll().ToList(); 81 | return Json(new { data = objCompanyList }); 82 | } 83 | 84 | 85 | [HttpDelete] 86 | public IActionResult Delete(int? id) 87 | { 88 | var CompanyToBeDeleted = _unitOfWork.Company.Get(u => u.Id == id); 89 | if (CompanyToBeDeleted == null) 90 | { 91 | return Json(new { success = false, message = "Error while deleting" }); 92 | } 93 | 94 | _unitOfWork.Company.Remove(CompanyToBeDeleted); 95 | _unitOfWork.Save(); 96 | 97 | return Json(new { success = true, message = "Delete Successful" }); 98 | } 99 | 100 | #endregion 101 | } 102 | } 103 | 104 | 105 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Microsoft.AspNetCore.Authorization; 9 | using Microsoft.AspNetCore.Identity; 10 | using Microsoft.AspNetCore.Identity.UI.Services; 11 | using Microsoft.AspNetCore.Mvc; 12 | using Microsoft.AspNetCore.Mvc.RazorPages; 13 | using Microsoft.AspNetCore.WebUtilities; 14 | 15 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 16 | { 17 | [AllowAnonymous] 18 | public class RegisterConfirmationModel : PageModel 19 | { 20 | private readonly UserManager _userManager; 21 | private readonly IEmailSender _sender; 22 | 23 | public RegisterConfirmationModel(UserManager userManager, IEmailSender sender) 24 | { 25 | _userManager = userManager; 26 | _sender = sender; 27 | } 28 | 29 | /// 30 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 31 | /// directly from your code. This API may change or be removed in future releases. 32 | /// 33 | public string Email { get; set; } 34 | 35 | /// 36 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 37 | /// directly from your code. This API may change or be removed in future releases. 38 | /// 39 | public bool DisplayConfirmAccountLink { get; set; } 40 | 41 | /// 42 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 43 | /// directly from your code. This API may change or be removed in future releases. 44 | /// 45 | public string EmailConfirmationUrl { get; set; } 46 | 47 | public async Task OnGetAsync(string email, string returnUrl = null) 48 | { 49 | if (email == null) 50 | { 51 | return RedirectToPage("/Index"); 52 | } 53 | returnUrl = returnUrl ?? Url.Content("~/"); 54 | 55 | var user = await _userManager.FindByEmailAsync(email); 56 | if (user == null) 57 | { 58 | return NotFound($"Unable to load user with email '{email}'."); 59 | } 60 | 61 | Email = email; 62 | // Once you add a real email sender, you should remove this code that lets you confirm the account 63 | DisplayConfirmAccountLink = true; 64 | if (DisplayConfirmAccountLink) 65 | { 66 | var userId = await _userManager.GetUserIdAsync(user); 67 | var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); 68 | code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); 69 | EmailConfirmationUrl = Url.Page( 70 | "/Account/ConfirmEmail", 71 | pageHandler: null, 72 | values: new { area = "Identity", userId = userId, code = code, returnUrl = returnUrl }, 73 | protocol: Request.Scheme); 74 | } 75 | 76 | return Page(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using Microsoft.AspNetCore.Identity; 9 | using Microsoft.AspNetCore.Mvc; 10 | using Microsoft.AspNetCore.Mvc.RazorPages; 11 | using Microsoft.Extensions.Logging; 12 | 13 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 14 | { 15 | public class GenerateRecoveryCodesModel : PageModel 16 | { 17 | private readonly UserManager _userManager; 18 | private readonly ILogger _logger; 19 | 20 | public GenerateRecoveryCodesModel( 21 | UserManager userManager, 22 | ILogger logger) 23 | { 24 | _userManager = userManager; 25 | _logger = logger; 26 | } 27 | 28 | /// 29 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 30 | /// directly from your code. This API may change or be removed in future releases. 31 | /// 32 | [TempData] 33 | public string[] RecoveryCodes { get; set; } 34 | 35 | /// 36 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 37 | /// directly from your code. This API may change or be removed in future releases. 38 | /// 39 | [TempData] 40 | public string StatusMessage { get; set; } 41 | 42 | public async Task OnGetAsync() 43 | { 44 | var user = await _userManager.GetUserAsync(User); 45 | if (user == null) 46 | { 47 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 48 | } 49 | 50 | var isTwoFactorEnabled = await _userManager.GetTwoFactorEnabledAsync(user); 51 | if (!isTwoFactorEnabled) 52 | { 53 | throw new InvalidOperationException($"Cannot generate recovery codes for user because they do not have 2FA enabled."); 54 | } 55 | 56 | return Page(); 57 | } 58 | 59 | public async Task OnPostAsync() 60 | { 61 | var user = await _userManager.GetUserAsync(User); 62 | if (user == null) 63 | { 64 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 65 | } 66 | 67 | var isTwoFactorEnabled = await _userManager.GetTwoFactorEnabledAsync(user); 68 | var userId = await _userManager.GetUserIdAsync(user); 69 | if (!isTwoFactorEnabled) 70 | { 71 | throw new InvalidOperationException($"Cannot generate recovery codes for user as they do not have 2FA enabled."); 72 | } 73 | 74 | var recoveryCodes = await _userManager.GenerateNewTwoFactorRecoveryCodesAsync(user, 10); 75 | RecoveryCodes = recoveryCodes.ToArray(); 76 | 77 | _logger.LogInformation("User with ID '{UserId}' has generated new 2FA recovery codes.", userId); 78 | StatusMessage = "You have generated new recovery codes."; 79 | return RedirectToPage("./ShowRecoveryCodes"); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ExternalLogin.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ExternalLoginModel 3 | @{ 4 | ViewData["Title"] = "Register"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |

Associate your @Model.ProviderDisplayName account.

9 |
10 | 11 |

12 | You've successfully authenticated with @Model.ProviderDisplayName. 13 | Please enter an email address for this site below and click the Register button to finish 14 | logging in. 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 | 50 |
51 |
52 | 53 | 54 | 55 |
56 | 57 |
58 |
59 |
60 | 61 | @section Scripts { 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.ComponentModel.DataAnnotations; 7 | using System.Text; 8 | using System.Text.Encodings.Web; 9 | using System.Threading.Tasks; 10 | using Microsoft.AspNetCore.Authorization; 11 | using Microsoft.AspNetCore.Identity; 12 | using Microsoft.AspNetCore.Identity.UI.Services; 13 | using Microsoft.AspNetCore.Mvc; 14 | using Microsoft.AspNetCore.Mvc.RazorPages; 15 | using Microsoft.AspNetCore.WebUtilities; 16 | 17 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 18 | { 19 | [AllowAnonymous] 20 | public class ResendEmailConfirmationModel : PageModel 21 | { 22 | private readonly UserManager _userManager; 23 | private readonly IEmailSender _emailSender; 24 | 25 | public ResendEmailConfirmationModel(UserManager userManager, IEmailSender emailSender) 26 | { 27 | _userManager = userManager; 28 | _emailSender = emailSender; 29 | } 30 | 31 | /// 32 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 33 | /// directly from your code. This API may change or be removed in future releases. 34 | /// 35 | [BindProperty] 36 | public InputModel Input { get; set; } 37 | 38 | /// 39 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 40 | /// directly from your code. This API may change or be removed in future releases. 41 | /// 42 | public class InputModel 43 | { 44 | /// 45 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 46 | /// directly from your code. This API may change or be removed in future releases. 47 | /// 48 | [Required] 49 | [EmailAddress] 50 | public string Email { get; set; } 51 | } 52 | 53 | public void OnGet() 54 | { 55 | } 56 | 57 | public async Task OnPostAsync() 58 | { 59 | if (!ModelState.IsValid) 60 | { 61 | return Page(); 62 | } 63 | 64 | var user = await _userManager.FindByEmailAsync(Input.Email); 65 | if (user == null) 66 | { 67 | ModelState.AddModelError(string.Empty, "Verification email sent. Please check your email."); 68 | return Page(); 69 | } 70 | 71 | var userId = await _userManager.GetUserIdAsync(user); 72 | var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); 73 | code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); 74 | var callbackUrl = Url.Page( 75 | "/Account/ConfirmEmail", 76 | pageHandler: null, 77 | values: new { userId = userId, code = code }, 78 | protocol: Request.Scheme); 79 | await _emailSender.SendEmailAsync( 80 | Input.Email, 81 | "Confirm your email", 82 | $"Please confirm your account by clicking here."); 83 | 84 | ModelState.AddModelError(string.Empty, "Verification email sent. Please check your email."); 85 | return Page(); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.ComponentModel.DataAnnotations; 7 | using System.Text; 8 | using System.Text.Encodings.Web; 9 | using System.Threading.Tasks; 10 | using Microsoft.AspNetCore.Authorization; 11 | using Microsoft.AspNetCore.Identity; 12 | using Microsoft.AspNetCore.Identity.UI.Services; 13 | using Microsoft.AspNetCore.Mvc; 14 | using Microsoft.AspNetCore.Mvc.RazorPages; 15 | using Microsoft.AspNetCore.WebUtilities; 16 | 17 | namespace BulkyBookWeb.Areas.Identity.Pages.Account 18 | { 19 | public class ForgotPasswordModel : PageModel 20 | { 21 | private readonly UserManager _userManager; 22 | private readonly IEmailSender _emailSender; 23 | 24 | public ForgotPasswordModel(UserManager userManager, IEmailSender emailSender) 25 | { 26 | _userManager = userManager; 27 | _emailSender = emailSender; 28 | } 29 | 30 | /// 31 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 32 | /// directly from your code. This API may change or be removed in future releases. 33 | /// 34 | [BindProperty] 35 | public InputModel Input { get; set; } 36 | 37 | /// 38 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 39 | /// directly from your code. This API may change or be removed in future releases. 40 | /// 41 | public class InputModel 42 | { 43 | /// 44 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 45 | /// directly from your code. This API may change or be removed in future releases. 46 | /// 47 | [Required] 48 | [EmailAddress] 49 | public string Email { get; set; } 50 | } 51 | 52 | public async Task OnPostAsync() 53 | { 54 | if (ModelState.IsValid) 55 | { 56 | var user = await _userManager.FindByEmailAsync(Input.Email); 57 | if (user == null || !(await _userManager.IsEmailConfirmedAsync(user))) 58 | { 59 | // Don't reveal that the user does not exist or is not confirmed 60 | return RedirectToPage("./ForgotPasswordConfirmation"); 61 | } 62 | 63 | // For more information on how to enable account confirmation and password reset please 64 | // visit https://go.microsoft.com/fwlink/?LinkID=532713 65 | var code = await _userManager.GeneratePasswordResetTokenAsync(user); 66 | code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); 67 | var callbackUrl = Url.Page( 68 | "/Account/ResetPassword", 69 | pageHandler: null, 70 | values: new { area = "Identity", code }, 71 | protocol: Request.Scheme); 72 | 73 | await _emailSender.SendEmailAsync( 74 | Input.Email, 75 | "Reset Password", 76 | $"Please reset your password by clicking here."); 77 | 78 | return RedirectToPage("./ForgotPasswordConfirmation"); 79 | } 80 | 81 | return Page(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Admin/Controllers/CategoryController.cs: -------------------------------------------------------------------------------- 1 | using BulkyBook.DataAccess.Data; 2 | using BulkyBook.DataAccess.Repository.IRepository; 3 | using BulkyBook.Models; 4 | using BulkyBook.Utility; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace BulkyBookWeb.Areas.Admin.Controllers 9 | { 10 | [Area("Admin")] 11 | [Authorize(Roles = SD.Role_Admin)] 12 | public class CategoryController : Controller 13 | { 14 | private readonly IUnitOfWork _unitOfWork; 15 | public CategoryController(IUnitOfWork unitOfWork) 16 | { 17 | _unitOfWork = unitOfWork; 18 | } 19 | public IActionResult Index() 20 | { 21 | List objCatagoryList = _unitOfWork.Category.GetAll().ToList(); 22 | 23 | return View(objCatagoryList); 24 | } 25 | public IActionResult Create() 26 | { 27 | return View(); 28 | } 29 | [HttpPost] 30 | public IActionResult Create(Category obj) 31 | { 32 | if (obj.Name == obj.DisplayOrder.ToString()) 33 | { 34 | ModelState.AddModelError("Name", "The DisplayOrder cannot exactly match the Name."); 35 | } 36 | 37 | if (obj.Name != null && obj.Name.ToLower() == "test") 38 | { 39 | ModelState.AddModelError("Name", "Test is invalid value"); 40 | } 41 | 42 | if (ModelState.IsValid) 43 | { 44 | _unitOfWork.Category.Add(obj); 45 | _unitOfWork.Save(); 46 | TempData["success"] = "Category Created Successfully"; 47 | return RedirectToAction("Index"); 48 | } 49 | return View(); 50 | } 51 | public IActionResult Edit(int? id) 52 | { 53 | if (id == null || id == 0) 54 | { 55 | return NotFound(); 56 | } 57 | Category? categoryFromDb = _unitOfWork.Category.Get(u => u.Id == id); 58 | /* 59 | Category? categoryFromDb1 = _db.Categories.FirstOrDefault(u => u.Id == id); 60 | Category? categoryFromDb2 = _db.Categories.Where(u => u.Id == id).FirstOrDefault();*/ 61 | 62 | if (categoryFromDb == null) 63 | { 64 | return NotFound(); 65 | } 66 | return View(categoryFromDb); 67 | } 68 | [HttpPost] 69 | public IActionResult Edit(Category obj) 70 | { 71 | 72 | if (ModelState.IsValid) 73 | { 74 | _unitOfWork.Category.Update(obj); 75 | _unitOfWork.Save(); 76 | TempData["success"] = "Category Updated Successfully"; 77 | 78 | return RedirectToAction("Index"); 79 | } 80 | return View(); 81 | } 82 | 83 | public IActionResult Delete(int? id) 84 | { 85 | if (id == null || id == 0) 86 | { 87 | return NotFound(); 88 | } 89 | Category? categoryFromDb = _unitOfWork.Category.Get(u => u.Id == id); 90 | 91 | if (categoryFromDb == null) 92 | { 93 | return NotFound(); 94 | } 95 | return View(categoryFromDb); 96 | } 97 | [HttpPost, ActionName("Delete")] 98 | public IActionResult DeletePOST(int? id) 99 | { 100 | Category? obj = _unitOfWork.Category.Get(u => u.Id == id); 101 | if (obj == null) 102 | { 103 | return NotFound(); 104 | } 105 | _unitOfWork.Category.Remove(obj); 106 | _unitOfWork.Save(); 107 | TempData["success"] = "Category Deleted Successfully"; 108 | 109 | return RedirectToAction("Index"); 110 | } 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.Identity; 8 | using Microsoft.AspNetCore.Mvc; 9 | using Microsoft.AspNetCore.Mvc.RazorPages; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 13 | { 14 | public class TwoFactorAuthenticationModel : PageModel 15 | { 16 | private readonly UserManager _userManager; 17 | private readonly SignInManager _signInManager; 18 | private readonly ILogger _logger; 19 | 20 | public TwoFactorAuthenticationModel( 21 | UserManager userManager, SignInManager signInManager, ILogger logger) 22 | { 23 | _userManager = userManager; 24 | _signInManager = signInManager; 25 | _logger = logger; 26 | } 27 | 28 | /// 29 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 30 | /// directly from your code. This API may change or be removed in future releases. 31 | /// 32 | public bool HasAuthenticator { get; set; } 33 | 34 | /// 35 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 36 | /// directly from your code. This API may change or be removed in future releases. 37 | /// 38 | public int RecoveryCodesLeft { get; set; } 39 | 40 | /// 41 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 42 | /// directly from your code. This API may change or be removed in future releases. 43 | /// 44 | [BindProperty] 45 | public bool Is2faEnabled { get; set; } 46 | 47 | /// 48 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 49 | /// directly from your code. This API may change or be removed in future releases. 50 | /// 51 | public bool IsMachineRemembered { get; set; } 52 | 53 | /// 54 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 55 | /// directly from your code. This API may change or be removed in future releases. 56 | /// 57 | [TempData] 58 | public string StatusMessage { get; set; } 59 | 60 | public async Task OnGetAsync() 61 | { 62 | var user = await _userManager.GetUserAsync(User); 63 | if (user == null) 64 | { 65 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 66 | } 67 | 68 | HasAuthenticator = await _userManager.GetAuthenticatorKeyAsync(user) != null; 69 | Is2faEnabled = await _userManager.GetTwoFactorEnabledAsync(user); 70 | IsMachineRemembered = await _signInManager.IsTwoFactorClientRememberedAsync(user); 71 | RecoveryCodesLeft = await _userManager.CountRecoveryCodesAsync(user); 72 | 73 | return Page(); 74 | } 75 | 76 | public async Task OnPostAsync() 77 | { 78 | var user = await _userManager.GetUserAsync(User); 79 | if (user == null) 80 | { 81 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 82 | } 83 | 84 | await _signInManager.ForgetTwoFactorClientAsync(); 85 | StatusMessage = "The current browser has been forgotten. When you login again from this browser you will be prompted for your 2fa code."; 86 | return RedirectToPage(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | #nullable disable 4 | 5 | using System; 6 | using System.ComponentModel.DataAnnotations; 7 | using System.Threading.Tasks; 8 | using Microsoft.AspNetCore.Identity; 9 | using Microsoft.AspNetCore.Mvc; 10 | using Microsoft.AspNetCore.Mvc.RazorPages; 11 | using Microsoft.Extensions.Logging; 12 | 13 | namespace BulkyBookWeb.Areas.Identity.Pages.Account.Manage 14 | { 15 | public class DeletePersonalDataModel : PageModel 16 | { 17 | private readonly UserManager _userManager; 18 | private readonly SignInManager _signInManager; 19 | private readonly ILogger _logger; 20 | 21 | public DeletePersonalDataModel( 22 | UserManager userManager, 23 | SignInManager signInManager, 24 | ILogger logger) 25 | { 26 | _userManager = userManager; 27 | _signInManager = signInManager; 28 | _logger = logger; 29 | } 30 | 31 | /// 32 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 33 | /// directly from your code. This API may change or be removed in future releases. 34 | /// 35 | [BindProperty] 36 | public InputModel Input { get; set; } 37 | 38 | /// 39 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 40 | /// directly from your code. This API may change or be removed in future releases. 41 | /// 42 | public class InputModel 43 | { 44 | /// 45 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 46 | /// directly from your code. This API may change or be removed in future releases. 47 | /// 48 | [Required] 49 | [DataType(DataType.Password)] 50 | public string Password { get; set; } 51 | } 52 | 53 | /// 54 | /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used 55 | /// directly from your code. This API may change or be removed in future releases. 56 | /// 57 | public bool RequirePassword { get; set; } 58 | 59 | public async Task OnGet() 60 | { 61 | var user = await _userManager.GetUserAsync(User); 62 | if (user == null) 63 | { 64 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 65 | } 66 | 67 | RequirePassword = await _userManager.HasPasswordAsync(user); 68 | return Page(); 69 | } 70 | 71 | public async Task OnPostAsync() 72 | { 73 | var user = await _userManager.GetUserAsync(User); 74 | if (user == null) 75 | { 76 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); 77 | } 78 | 79 | RequirePassword = await _userManager.HasPasswordAsync(user); 80 | if (RequirePassword) 81 | { 82 | if (!await _userManager.CheckPasswordAsync(user, Input.Password)) 83 | { 84 | ModelState.AddModelError(string.Empty, "Incorrect password."); 85 | return Page(); 86 | } 87 | } 88 | 89 | var result = await _userManager.DeleteAsync(user); 90 | var userId = await _userManager.GetUserIdAsync(user); 91 | if (!result.Succeeded) 92 | { 93 | throw new InvalidOperationException($"Unexpected error occurred deleting user."); 94 | } 95 | 96 | await _signInManager.SignOutAsync(); 97 | 98 | _logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId); 99 | 100 | return Redirect("~/"); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Bulky/BulkyWeb/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v5.1.0 (https://getbootstrap.com/) 3 | * Copyright 2011-2021 The Bootstrap Authors 4 | * Copyright 2011-2021 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ --------------------------------------------------------------------------------