├── .gitignore ├── APM-Begin ├── APM.MVC │ ├── APM.MVC.csproj │ ├── Controllers │ │ ├── HomeController.cs │ │ └── ProductController.cs │ ├── Models │ │ ├── ErrorViewModel.cs │ │ ├── PricingDetailViewModel.cs │ │ └── ProductListViewModel.cs │ ├── Program.cs │ ├── Startup.cs │ ├── Views │ │ ├── Home │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Product │ │ │ ├── Index.cshtml │ │ │ ├── PriceUpdate.cshtml │ │ │ └── ProductList.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map ├── APM.SL.Test │ ├── APM.SL.Test.csproj │ ├── DiscountTest.cs │ └── ProductTest.cs ├── APM.SL │ ├── APM.SL.csproj │ ├── Discount.cs │ └── Product.cs ├── APM.Utilities.Test │ ├── APM.Utilities.Test.csproj │ └── EmailTest.cs ├── APM.Utilities │ ├── .editorconfig │ ├── APM.Utilities.csproj │ ├── Guard.cs │ ├── OperationResult.cs │ ├── Utility.cs │ └── ValidationException.cs └── APM.sln ├── APM-Final ├── APM.MVC │ ├── APM.MVC.csproj │ ├── Controllers │ │ ├── HomeController.cs │ │ └── ProductController.cs │ ├── Models │ │ ├── ErrorViewModel.cs │ │ ├── PricingDetailViewModel.cs │ │ └── ProductListViewModel.cs │ ├── Program.cs │ ├── Startup.cs │ ├── Views │ │ ├── Home │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Product │ │ │ ├── Index.cshtml │ │ │ ├── PriceUpdate.cshtml │ │ │ └── ProductList.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map ├── APM.SL.Test │ ├── APM.SL.Test.csproj │ ├── DiscountTest.cs │ └── ProductTest.cs ├── APM.SL │ ├── APM.SL.csproj │ ├── Discount.cs │ └── Product.cs ├── APM.Utilities.Test │ ├── APM.Utilities.Test.csproj │ └── EmailTest.cs ├── APM.Utilities │ ├── .editorconfig │ ├── APM.Utilities.csproj │ ├── DiscountNotFoundException.cs │ ├── Guard.cs │ ├── OperationResult.cs │ ├── Utility.cs │ └── ValidationException.cs └── APM.sln ├── APM-WithUI ├── APM.MVC │ ├── APM.MVC.csproj │ ├── Controllers │ │ ├── HomeController.cs │ │ └── ProductController.cs │ ├── Models │ │ ├── ErrorViewModel.cs │ │ ├── PricingDetailViewModel.cs │ │ └── ProductListViewModel.cs │ ├── Program.cs │ ├── Startup.cs │ ├── Views │ │ ├── Home │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Product │ │ │ ├── Index.cshtml │ │ │ ├── PriceUpdate.cshtml │ │ │ └── ProductList.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map ├── APM.SL.Test │ ├── APM.SL.Test.csproj │ ├── DiscountTest.cs │ └── ProductTest.cs ├── APM.SL │ ├── APM.SL.csproj │ ├── Discount.cs │ └── Product.cs ├── APM.Utilities.Test │ ├── APM.Utilities.Test.csproj │ └── EmailTest.cs ├── APM.Utilities │ ├── .editorconfig │ ├── APM.Utilities.csproj │ ├── DiscountNotFoundException.cs │ ├── Guard.cs │ ├── OperationResult.cs │ ├── Utility.cs │ └── ValidationException.cs ├── APM.Win │ ├── APM.Win.csproj │ ├── PriceUpdate.Designer.cs │ ├── PriceUpdate.cs │ └── Program.cs └── APMWithUI.sln ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/APM.MVC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers; buildtransitive 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using APM.MVC.Models; 9 | 10 | namespace APM.MVC.Controllers 11 | { 12 | public class HomeController : Controller 13 | { 14 | private readonly ILogger _logger; 15 | 16 | public HomeController(ILogger logger) 17 | { 18 | _logger = logger; 19 | } 20 | 21 | public IActionResult Index() 22 | { 23 | return View(); 24 | } 25 | 26 | public IActionResult Privacy() 27 | { 28 | return View(); 29 | } 30 | 31 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 32 | public IActionResult Error() 33 | { 34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using APM.MVC.Models; 2 | using APM.SL; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | 6 | namespace APM.MVC.Controllers 7 | { 8 | public class ProductController : Controller 9 | { 10 | 11 | // GET action 12 | // When navigating to the page. 13 | public IActionResult PriceUpdate() 14 | { 15 | // Create model 16 | var productVM = new ProductViewModel(); 17 | productVM.EffectiveDate = DateTime.Now; 18 | 19 | ViewBag.IsAcceptable = false; 20 | 21 | return View(productVM); 22 | } 23 | 24 | [HttpPost] 25 | [ValidateAntiForgeryToken] 26 | public IActionResult PriceUpdate(ProductViewModel productVM) 27 | { 28 | // Code to save the product 29 | 30 | return View(nameof(Index)); 31 | } 32 | 33 | [HttpPost] 34 | [ValidateAntiForgeryToken] 35 | public IActionResult Calculate(ProductViewModel productVM) 36 | { 37 | var price = productVM.Price; 38 | var cost = productVM.Cost; 39 | 40 | // Calculate and check the profit margin 41 | var product = new Product(); 42 | var calculatedMargin = product.CalculateMargin(cost, price); 43 | 44 | // Display the results 45 | ViewBag.CalculateMargin = calculatedMargin; 46 | ViewBag.IsAcceptable = calculatedMargin >= 40; 47 | 48 | return View(nameof(PriceUpdate), productVM); 49 | } 50 | 51 | // GET: Product 52 | public ActionResult Index() 53 | { 54 | return View(); 55 | } 56 | 57 | } 58 | } -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.MVC.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Models/PricingDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace APM.MVC.Models 8 | { 9 | public class ProductViewModel 10 | { 11 | public string Category { get; set; } 12 | public string Cost { get; set; } 13 | public int Id { get; private set; } 14 | 15 | [DataType(DataType.Date)] 16 | [DisplayFormat(DataFormatString = "{0:d}")] 17 | public DateTimeOffset EffectiveDate { get; set; } 18 | 19 | public string Name { get; set; } 20 | 21 | public string Price { get; set; } 22 | public string Reason { get; set; } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Models/ProductListViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace APM.MVC.Models 7 | { 8 | public class ProductListViewModel 9 | { 10 | public List products { get; set; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace APM.MVC 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.HttpsPolicy; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Hosting; 11 | 12 | namespace APM.MVC 13 | { 14 | public class Startup 15 | { 16 | public Startup(IConfiguration configuration) 17 | { 18 | Configuration = configuration; 19 | } 20 | 21 | public IConfiguration Configuration { get; } 22 | 23 | // This method gets called by the runtime. Use this method to add services to the container. 24 | public void ConfigureServices(IServiceCollection services) 25 | { 26 | services.AddControllersWithViews(); 27 | } 28 | 29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 31 | { 32 | if (env.IsDevelopment()) 33 | { 34 | app.UseDeveloperExceptionPage(); 35 | } 36 | else 37 | { 38 | app.UseExceptionHandler("/Home/Error"); 39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 40 | app.UseHsts(); 41 | } 42 | // app.UseHttpsRedirection(); 43 | app.UseStaticFiles(); 44 | 45 | app.UseRouting(); 46 | 47 | app.UseAuthorization(); 48 | 49 | app.UseEndpoints(endpoints => 50 | { 51 | endpoints.MapControllerRoute( 52 | name: "default", 53 | pattern: "{controller=Home}/{action=Index}/{id?}"); 54 | }); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
6 |

Welcome

7 |
8 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Product/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Product List"; 3 | } 4 | 5 |
6 |

Product List

7 |
8 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Product/PriceUpdate.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Price Update"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 18 |
19 | 20 | 21 |
22 |
23 |
24 | 25 |
26 | 27 | 28 |
29 |
30 |
31 | 32 |
33 | 34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 | 42 |
43 |
44 |
45 | 46 |
47 | 48 | 49 |
50 |
51 | 52 |
53 | 54 |
55 |
56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | @if (ViewBag.IsAcceptable != null && ViewBag.IsAcceptable) 69 | { 70 | 74 | } 75 | else 76 | { 77 | 81 | } 82 | 83 | 84 | 85 | 86 |
Minimim Required Profit MarginCalculated Profit Margin
66 | 40% 67 | 72 | @ViewBag.CalculateMargin% 73 | 79 | @ViewBag.CalculateMargin% 80 |
87 |
88 |
89 |
90 |
91 | 92 | 93 |
94 |
95 |
96 | 101 | 108 |
109 |
110 | 111 |
112 |
113 | 119 | 126 |
127 | 128 |
129 |
130 |
131 |
132 |
133 | 134 | @section Scripts { 135 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} 136 | } 137 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Product/ProductList.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductListViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Product List"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | 10 | 11 | 14 | 17 | 20 | 23 | 26 | 27 | 28 | @foreach (var product in Model.products) 29 | { 30 | 31 | 34 | 37 | 40 | 42 | 45 | 50 | 51 | } 52 |
12 | Name 13 | 15 | Current Cost 16 | 18 | Current Price 19 | 21 | Current Margin 22 | 24 | Last Effective Date 25 |
32 | @Html.DisplayFor(modelItem => product.Name) 33 | 35 | @Html.DisplayFor(modelItem => product.Cost) 36 | 38 | @Html.DisplayFor(modelItem => product.Price) 39 | 41 | 43 | @Html.DisplayFor(modelItem => product.EffectiveDate) 44 | 46 | @Html.ActionLink("Edit", "Edit", new { id = product.Id }) | 47 | @Html.ActionLink("Details", "Details", new { id = product.Id }) | 48 | @Html.ActionLink("Delete", "Delete", new { id = product.Id }) 49 |
53 | 54 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - Acme Product Management 7 | 8 | 9 | 10 | 11 |
12 | 34 |
35 |
36 |
37 | @RenderBody() 38 |
39 |
40 | 41 |
42 |
43 | © 2019 - APM.MVC - Privacy 44 |
45 |
46 | 47 | 48 | 49 | @RenderSection("Scripts", required: false) 50 | 51 | 52 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using APM.MVC 2 | @using APM.MVC.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/css/site.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 | /* Provide sufficient contrast against white background */ 11 | a { 12 | color: #0366d6; 13 | } 14 | 15 | .btn-primary { 16 | color: #fff; 17 | background-color: #1b6ec2; 18 | border-color: #1861ac; 19 | } 20 | 21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 22 | color: #fff; 23 | background-color: #1b6ec2; 24 | border-color: #1861ac; 25 | } 26 | 27 | /* Sticky footer styles 28 | -------------------------------------------------- */ 29 | html { 30 | font-size: 14px; 31 | } 32 | @media (min-width: 768px) { 33 | html { 34 | font-size: 16px; 35 | } 36 | } 37 | 38 | .border-top { 39 | border-top: 1px solid #e5e5e5; 40 | } 41 | .border-bottom { 42 | border-bottom: 1px solid #e5e5e5; 43 | } 44 | 45 | .box-shadow { 46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 47 | } 48 | 49 | button.accept-policy { 50 | font-size: 1rem; 51 | line-height: inherit; 52 | } 53 | 54 | /* Sticky footer styles 55 | -------------------------------------------------- */ 56 | html { 57 | position: relative; 58 | min-height: 100%; 59 | } 60 | 61 | body { 62 | /* Margin bottom by footer height */ 63 | margin-bottom: 60px; 64 | } 65 | .footer { 66 | position: absolute; 67 | bottom: 0; 68 | width: 100%; 69 | white-space: nowrap; 70 | line-height: 60px; /* Vertically center the text there */ 71 | } 72 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-Begin/APM.MVC/wwwroot/favicon.ico -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/js/site.js: -------------------------------------------------------------------------------- 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 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2018 Twitter, Inc. 4 | Copyright (c) 2011-2018 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 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { 22 | display: block; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 28 | font-size: 1rem; 29 | font-weight: 400; 30 | line-height: 1.5; 31 | color: #212529; 32 | text-align: left; 33 | background-color: #fff; 34 | } 35 | 36 | [tabindex="-1"]:focus { 37 | outline: 0 !important; 38 | } 39 | 40 | hr { 41 | box-sizing: content-box; 42 | height: 0; 43 | overflow: visible; 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | margin-top: 0; 48 | margin-bottom: 0.5rem; 49 | } 50 | 51 | p { 52 | margin-top: 0; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | abbr[title], 57 | abbr[data-original-title] { 58 | text-decoration: underline; 59 | -webkit-text-decoration: underline dotted; 60 | text-decoration: underline dotted; 61 | cursor: help; 62 | border-bottom: 0; 63 | -webkit-text-decoration-skip-ink: none; 64 | text-decoration-skip-ink: none; 65 | } 66 | 67 | address { 68 | margin-bottom: 1rem; 69 | font-style: normal; 70 | line-height: inherit; 71 | } 72 | 73 | ol, 74 | ul, 75 | dl { 76 | margin-top: 0; 77 | margin-bottom: 1rem; 78 | } 79 | 80 | ol ol, 81 | ul ul, 82 | ol ul, 83 | ul ol { 84 | margin-bottom: 0; 85 | } 86 | 87 | dt { 88 | font-weight: 700; 89 | } 90 | 91 | dd { 92 | margin-bottom: .5rem; 93 | margin-left: 0; 94 | } 95 | 96 | blockquote { 97 | margin: 0 0 1rem; 98 | } 99 | 100 | b, 101 | strong { 102 | font-weight: bolder; 103 | } 104 | 105 | small { 106 | font-size: 80%; 107 | } 108 | 109 | sub, 110 | sup { 111 | position: relative; 112 | font-size: 75%; 113 | line-height: 0; 114 | vertical-align: baseline; 115 | } 116 | 117 | sub { 118 | bottom: -.25em; 119 | } 120 | 121 | sup { 122 | top: -.5em; 123 | } 124 | 125 | a { 126 | color: #007bff; 127 | text-decoration: none; 128 | background-color: transparent; 129 | } 130 | 131 | a:hover { 132 | color: #0056b3; 133 | text-decoration: underline; 134 | } 135 | 136 | a:not([href]):not([tabindex]) { 137 | color: inherit; 138 | text-decoration: none; 139 | } 140 | 141 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 142 | color: inherit; 143 | text-decoration: none; 144 | } 145 | 146 | a:not([href]):not([tabindex]):focus { 147 | outline: 0; 148 | } 149 | 150 | pre, 151 | code, 152 | kbd, 153 | samp { 154 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 155 | font-size: 1em; 156 | } 157 | 158 | pre { 159 | margin-top: 0; 160 | margin-bottom: 1rem; 161 | overflow: auto; 162 | } 163 | 164 | figure { 165 | margin: 0 0 1rem; 166 | } 167 | 168 | img { 169 | vertical-align: middle; 170 | border-style: none; 171 | } 172 | 173 | svg { 174 | overflow: hidden; 175 | vertical-align: middle; 176 | } 177 | 178 | table { 179 | border-collapse: collapse; 180 | } 181 | 182 | caption { 183 | padding-top: 0.75rem; 184 | padding-bottom: 0.75rem; 185 | color: #6c757d; 186 | text-align: left; 187 | caption-side: bottom; 188 | } 189 | 190 | th { 191 | text-align: inherit; 192 | } 193 | 194 | label { 195 | display: inline-block; 196 | margin-bottom: 0.5rem; 197 | } 198 | 199 | button { 200 | border-radius: 0; 201 | } 202 | 203 | button:focus { 204 | outline: 1px dotted; 205 | outline: 5px auto -webkit-focus-ring-color; 206 | } 207 | 208 | input, 209 | button, 210 | select, 211 | optgroup, 212 | textarea { 213 | margin: 0; 214 | font-family: inherit; 215 | font-size: inherit; 216 | line-height: inherit; 217 | } 218 | 219 | button, 220 | input { 221 | overflow: visible; 222 | } 223 | 224 | button, 225 | select { 226 | text-transform: none; 227 | } 228 | 229 | select { 230 | word-wrap: normal; 231 | } 232 | 233 | button, 234 | [type="button"], 235 | [type="reset"], 236 | [type="submit"] { 237 | -webkit-appearance: button; 238 | } 239 | 240 | button:not(:disabled), 241 | [type="button"]:not(:disabled), 242 | [type="reset"]:not(:disabled), 243 | [type="submit"]:not(:disabled) { 244 | cursor: pointer; 245 | } 246 | 247 | button::-moz-focus-inner, 248 | [type="button"]::-moz-focus-inner, 249 | [type="reset"]::-moz-focus-inner, 250 | [type="submit"]::-moz-focus-inner { 251 | padding: 0; 252 | border-style: none; 253 | } 254 | 255 | input[type="radio"], 256 | input[type="checkbox"] { 257 | box-sizing: border-box; 258 | padding: 0; 259 | } 260 | 261 | input[type="date"], 262 | input[type="time"], 263 | input[type="datetime-local"], 264 | input[type="month"] { 265 | -webkit-appearance: listbox; 266 | } 267 | 268 | textarea { 269 | overflow: auto; 270 | resize: vertical; 271 | } 272 | 273 | fieldset { 274 | min-width: 0; 275 | padding: 0; 276 | margin: 0; 277 | border: 0; 278 | } 279 | 280 | legend { 281 | display: block; 282 | width: 100%; 283 | max-width: 100%; 284 | padding: 0; 285 | margin-bottom: .5rem; 286 | font-size: 1.5rem; 287 | line-height: inherit; 288 | color: inherit; 289 | white-space: normal; 290 | } 291 | 292 | progress { 293 | vertical-align: baseline; 294 | } 295 | 296 | [type="number"]::-webkit-inner-spin-button, 297 | [type="number"]::-webkit-outer-spin-button { 298 | height: auto; 299 | } 300 | 301 | [type="search"] { 302 | outline-offset: -2px; 303 | -webkit-appearance: none; 304 | } 305 | 306 | [type="search"]::-webkit-search-decoration { 307 | -webkit-appearance: none; 308 | } 309 | 310 | ::-webkit-file-upload-button { 311 | font: inherit; 312 | -webkit-appearance: button; 313 | } 314 | 315 | output { 316 | display: inline-block; 317 | } 318 | 319 | summary { 320 | display: list-item; 321 | cursor: pointer; 322 | } 323 | 324 | template { 325 | display: none; 326 | } 327 | 328 | [hidden] { 329 | display: none !important; 330 | } 331 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/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}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}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:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[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}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | // Unobtrusive validation support library for jQuery and jQuery Validate 2 | // Copyright (c) .NET Foundation. All rights reserved. 3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 4 | // @version v3.2.11 5 | !function(a){"function"==typeof define&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery-validation")):jQuery.validator.unobtrusive=a(jQuery)}(function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a("
  • ").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function u(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=f.unobtrusive.options||{},u=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),u("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),u("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),u("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var m,f=a.validator,v="unobtrusiveValidation";return f.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=u(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){f.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=u(this);a&&a.attachValidation()})}},m=f.unobtrusive.adapters,m.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},m.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},m.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},m.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},f.addMethod("__dummy__",function(a,e,n){return!0}),f.addMethod("regex",function(a,e,n){var t;return!!this.optional(e)||(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),f.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),f.methods.extension?(m.addSingleVal("accept","mimtype"),m.addSingleVal("extension","extension")):m.addSingleVal("extension","extension","accept"),m.addSingleVal("regex","pattern"),m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),m.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),m.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),m.add("required",function(a){"INPUT"===a.element.tagName.toUpperCase()&&"CHECKBOX"===a.element.type.toUpperCase()||e(a,"required",!0)}),m.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),m.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),m.add("fileextensions",["extensions"],function(a){e(a,"extension",a.params.extensions)}),a(function(){f.unobtrusive.parse(document)}),f.unobtrusive}); -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Begin/APM.MVC/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright JS Foundation and other contributors, https://js.foundation/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /APM-Begin/APM.SL.Test/APM.SL.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL.Test 6 | 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /APM-Begin/APM.SL.Test/DiscountTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Xunit; 4 | 5 | namespace APM.SL.Test 6 | { 7 | public class DiscountTest 8 | { 9 | // 10 | // FindDiscount 11 | // 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /APM-Begin/APM.SL.Test/ProductTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-Begin/APM.SL.Test/ProductTest.cs -------------------------------------------------------------------------------- /APM-Begin/APM.SL/APM.SL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /APM-Begin/APM.SL/Discount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace APM.SL 5 | { 6 | public class Discount 7 | { 8 | public int DiscountId { get; private set; } 9 | public string DiscountName { get; set; } 10 | 11 | public decimal PercentOff { get; set; } 12 | 13 | // ... Discount details 14 | 15 | public Discount FindDiscount(List discounts, string discountName) 16 | { 17 | if (discounts is null) return null; 18 | 19 | var foundDiscount = discounts.Find(d => d.DiscountName == discountName); 20 | 21 | return foundDiscount; 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /APM-Begin/APM.SL/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace APM.SL 5 | { 6 | public class Product 7 | { 8 | // Value Types 9 | public DateTime? EffectiveDate { get; set; } 10 | public decimal Cost { get; set; } 11 | public decimal Price { get; set; } 12 | public int ProductId { get; set; } 13 | 14 | // Reference Types 15 | public string Category { get; set; } 16 | 17 | public List Discounts { get; set; } 18 | 19 | public Discount ProductDiscount { get; set; } 20 | 21 | public string ProductName { get; set; } 22 | 23 | public string Reason { get; set; } 24 | 25 | 26 | 27 | /// 28 | /// Calculate the potential profit margin. 29 | /// 30 | /// Cost in dollars and cents (from user input as string) 31 | /// Suggested price in dollars and cents (from user input as string) 32 | /// Resulting profit margin 33 | public decimal CalculateMargin(string costInput, string priceInput) 34 | { 35 | decimal cost = decimal.Parse(costInput); 36 | decimal price = decimal.Parse(priceInput); 37 | 38 | var margin = ((price - cost) / price) * 100M; 39 | 40 | return margin; 41 | } 42 | 43 | 44 | 45 | /// 46 | /// Calculates the total amount of the discount 47 | /// 48 | /// 49 | public decimal CalculateTotalDiscount(decimal price, Discount discount) 50 | { 51 | if (price <= 0) throw new ArgumentException("Please enter the price"); 52 | 53 | if (discount is null) throw new ArgumentException("Please specify a discount"); 54 | 55 | var discountAmount = price * (discount.PercentOff / 100); 56 | 57 | return discountAmount; 58 | } 59 | 60 | /// 61 | /// Saves pricing details. 62 | /// 63 | /// 64 | public bool SavePrice(int productId, string cost, string price, 65 | string category, string reason, 66 | DateTime effectiveDate) 67 | { 68 | // Generates a warning if nullable is set to "warnings" 69 | // string name = null; 70 | // Console.WriteLine(name.Length); 71 | 72 | // To turn off unused parameter warnings 73 | Utility.LogToFile(new string[] { "Price Saved:", productId.ToString(), cost, price, category, reason, effectiveDate.ToString() }); 74 | 75 | // Validate arguments 76 | // Calls a method in the data layer to save the data... 77 | 78 | return true; 79 | } 80 | 81 | /// 82 | /// Validates the effective data according to two rules: 83 | /// - Effective date is required 84 | /// - Effective date is one week (or more) beyond the current date 85 | /// 86 | /// 87 | /// 88 | public bool ValidateEffectiveDate(DateTime? effectiveDate) 89 | { 90 | if (!effectiveDate.HasValue) return false; 91 | 92 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return false; 93 | 94 | return true; 95 | } 96 | 97 | public bool ValidateEffectiveDateWithRef(DateTime? effectiveDate, ref string validationMessage) 98 | { 99 | if (!effectiveDate.HasValue) 100 | { 101 | validationMessage = "Date has no value"; 102 | return false; 103 | }; 104 | 105 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) 106 | { 107 | validationMessage = "Date must be at least 7 days from today"; 108 | return false; 109 | } 110 | 111 | return true; 112 | } 113 | 114 | public bool ValidateEffectiveDateWithOut(DateTime? effectiveDate, out string validationMessage) 115 | { 116 | validationMessage = ""; 117 | if (!effectiveDate.HasValue) 118 | { 119 | validationMessage = "Date has no value"; 120 | return false; 121 | }; 122 | 123 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) 124 | { 125 | validationMessage = "Date must be at least 7 days from today"; 126 | return false; 127 | } 128 | 129 | return true; 130 | } 131 | 132 | public (bool IsValid, string ValidationMessage) ValidateEffectiveDateWithTuple(DateTime? effectiveDate) 133 | { 134 | if (!effectiveDate.HasValue) return (IsValid: false, ValidationMessage: "Date has no value"); 135 | 136 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return (false, "Date must be at least 7 days from today"); 137 | 138 | return (IsValid: true, ValidationMessage: ""); 139 | } 140 | 141 | public OperationResult ValidateEffectiveDateWithObject(DateTime? effectiveDate) 142 | { 143 | if (!effectiveDate.HasValue) return new OperationResult() 144 | { Success = false, ValidationMessage = "Date has no value" }; 145 | 146 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return new OperationResult() 147 | { Success = false, ValidationMessage = "Date must be at least 7 days from today" }; 148 | 149 | return new OperationResult() { Success = true }; 150 | } 151 | 152 | public bool ValidateEffectiveDateWithException(DateTime? effectiveDate) 153 | { 154 | if (!effectiveDate.HasValue) throw new ArgumentException("Please enter the effective date"); 155 | 156 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) throw new ArgumentException("Date must be at least 7 days from today"); 157 | 158 | return true; 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities.Test/APM.Utilities.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities.Test/EmailTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace APM.SL.Test 5 | { 6 | public class EmailTest 7 | { 8 | [Fact] 9 | public void SendEmail_WhenValidValues_ShouldReturnTrue() 10 | { 11 | // Arrange 12 | var expected = true; 13 | 14 | // Act 15 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 16 | "Please confirm our 1PM meeting", 17 | DateTime.Now); 18 | 19 | // Assert 20 | Assert.Equal(expected, actual); 21 | } 22 | 23 | [Fact] 24 | public void SendEmail_WhenOptionalValues_ShouldReturnTrue() 25 | { 26 | // Arrange 27 | var expected = true; 28 | 29 | // Act 30 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 31 | "Please confirm our 1PM meeting", 32 | DateTime.Now, 33 | saveCopy: true, highPriority:true, 34 | includeSignature: false); 35 | 36 | // Assert 37 | Assert.Equal(expected, actual); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # IDE0063: Use simple 'using' statement 4 | csharp_prefer_simple_using_statement = false:suggestion 5 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/APM.Utilities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/Guard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Guard 8 | { 9 | public static void ThrowIfNullOrEmpty(string argumentValue, string message, string parameterName) 10 | { 11 | if (string.IsNullOrWhiteSpace(argumentValue)) throw new ArgumentException(message, parameterName); 12 | } 13 | 14 | public static decimal ThrowIfNotPositiveDecimal(string argumentValue, string message, string parameterName) 15 | { 16 | var success = decimal.TryParse(argumentValue, out decimal result); 17 | if (!success || result < 0) throw new ArgumentException(message, parameterName); 18 | 19 | return result; 20 | } 21 | 22 | public static decimal ThrowIfNotPositiveNonZeroDecimal(string argumentValue, string message, string parameterName) 23 | { 24 | var success = decimal.TryParse(argumentValue, out decimal result); 25 | if (!success || result <= 0) throw new ArgumentException(message, parameterName); 26 | 27 | return result; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/OperationResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public class OperationResult 8 | { 9 | public bool Success { get; set; } 10 | public string ValidationMessage { get; set; } 11 | 12 | public OperationResult() 13 | { 14 | ValidationMessage = ""; 15 | Success = false; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Utility 8 | { 9 | public static bool SendEmail(string recipient, string subject, 10 | string body, DateTime sendDate, 11 | bool saveCopy = false, bool highPriority = false, 12 | bool includeSignature = true) 13 | { 14 | // Send email 15 | Utility.LogToFile(new string[] { "Email sent:", recipient, subject, body, sendDate.ToShortDateString(), 16 | saveCopy.ToString(), highPriority.ToString(), includeSignature.ToString() }); 17 | 18 | return true; 19 | } 20 | 21 | public static void LogToFile(string[] textToLog) 22 | { 23 | string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 24 | 25 | if (String.IsNullOrEmpty(docPath)) throw new InvalidOperationException("Path cannot be null"); 26 | 27 | using (StreamWriter w = File.AppendText(Path.Combine(docPath, "log.txt"))) 28 | { 29 | w.WriteLine(""); 30 | w.Write("Log Entry: "); 31 | w.WriteLine($"{DateTime.Now.ToLongTimeString()}"); 32 | foreach (var logText in textToLog) 33 | w.WriteLine($" - {logText}"); 34 | w.WriteLine("-------------------------------"); 35 | } 36 | } 37 | 38 | public static string RemoveParenthetical(this String text) 39 | { 40 | return Regex.Replace(text, @"\(.*\)", ""); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /APM-Begin/APM.Utilities/ValidationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.SL 4 | { 5 | [Serializable()] 6 | public class ValidationException : System.ArgumentException 7 | { 8 | public ValidationException() : base() { } 9 | 10 | public ValidationException(string message) : base(message) { } 11 | 12 | public ValidationException(string message, string paramName) : base(message, paramName) { } 13 | 14 | public ValidationException(string message, Exception inner) : base(message, inner) { } 15 | 16 | protected ValidationException(System.Runtime.Serialization.SerializationInfo info, 17 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /APM-Begin/APM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29326.143 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL", "APM.SL\APM.SL.csproj", "{7D10D82E-2BD9-4626-95F4-5979D5F0A66F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL.Test", "APM.SL.Test\APM.SL.Test.csproj", "{C332BD2C-D120-42F9-90D8-106AFAD4C1CE}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities", "APM.Utilities\APM.Utilities.csproj", "{1291C026-36DC-48A0-94C9-7C4C934E9C18}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities.Test", "APM.Utilities.Test\APM.Utilities.Test.csproj", "{80F03195-553E-49F2-909F-05D50F26E59A}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.MVC", "APM.MVC\APM.MVC.csproj", "{DA04EDBA-AA99-4411-AD76-33868604835D}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {5330F312-3A35-4D4E-B981-96659E196D29} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/APM.MVC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers; buildtransitive 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using APM.MVC.Models; 9 | 10 | namespace APM.MVC.Controllers 11 | { 12 | public class HomeController : Controller 13 | { 14 | private readonly ILogger _logger; 15 | 16 | public HomeController(ILogger logger) 17 | { 18 | _logger = logger; 19 | } 20 | 21 | public IActionResult Index() 22 | { 23 | return View(); 24 | } 25 | 26 | public IActionResult Privacy() 27 | { 28 | return View(); 29 | } 30 | 31 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 32 | public IActionResult Error() 33 | { 34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using APM.MVC.Models; 2 | using APM.SL; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | 6 | namespace APM.MVC.Controllers 7 | { 8 | public class ProductController : Controller 9 | { 10 | 11 | // GET action 12 | // When navigating to the page. 13 | public IActionResult PriceUpdate() 14 | { 15 | // Create model 16 | var productVM = new ProductViewModel(); 17 | productVM.EffectiveDate = DateTime.Now; 18 | 19 | ViewBag.IsAcceptable = false; 20 | 21 | return View(productVM); 22 | } 23 | 24 | [HttpPost] 25 | [ValidateAntiForgeryToken] 26 | public IActionResult PriceUpdate(ProductViewModel productVM) 27 | { 28 | // Code to save the product 29 | 30 | return View(nameof(Index)); 31 | } 32 | 33 | [HttpPost] 34 | [ValidateAntiForgeryToken] 35 | public IActionResult Calculate(ProductViewModel productVM) 36 | { 37 | var price = productVM.Price; 38 | var cost = productVM.Cost; 39 | 40 | decimal calculatedMargin = 0; 41 | try 42 | { 43 | 44 | // Calculate and check the profit margin 45 | var product = new Product(); 46 | calculatedMargin = product.CalculateMargin(cost, price); 47 | } 48 | catch (ValidationException ex) when (ex.ParamName == "cost") 49 | { 50 | ModelState.AddModelError("Cost", ex.Message.RemoveParenthetical()); 51 | } 52 | catch (ValidationException ex) when (ex.ParamName == "price") 53 | { 54 | ModelState.AddModelError("Price", ex.Message.RemoveParenthetical()); 55 | } 56 | 57 | // Display the results 58 | ViewBag.CalculateMargin = calculatedMargin; 59 | ViewBag.IsAcceptable = calculatedMargin >= 40; 60 | 61 | return View(nameof(PriceUpdate), productVM); 62 | } 63 | 64 | // GET: Product 65 | public ActionResult Index() 66 | { 67 | return View(); 68 | } 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.MVC.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Models/PricingDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace APM.MVC.Models 8 | { 9 | public class ProductViewModel 10 | { 11 | public string Category { get; set; } 12 | public string Cost { get; set; } 13 | public int Id { get; private set; } 14 | 15 | [DataType(DataType.Date)] 16 | [DisplayFormat(DataFormatString = "{0:d}")] 17 | public DateTimeOffset EffectiveDate { get; set; } 18 | 19 | public string Name { get; set; } 20 | 21 | public string Price { get; set; } 22 | public string Reason { get; set; } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Models/ProductListViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace APM.MVC.Models 7 | { 8 | public class ProductListViewModel 9 | { 10 | public List products { get; set; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace APM.MVC 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.HttpsPolicy; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Hosting; 11 | 12 | namespace APM.MVC 13 | { 14 | public class Startup 15 | { 16 | public Startup(IConfiguration configuration) 17 | { 18 | Configuration = configuration; 19 | } 20 | 21 | public IConfiguration Configuration { get; } 22 | 23 | // This method gets called by the runtime. Use this method to add services to the container. 24 | public void ConfigureServices(IServiceCollection services) 25 | { 26 | services.AddControllersWithViews(); 27 | } 28 | 29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 31 | { 32 | if (env.IsDevelopment()) 33 | { 34 | app.UseDeveloperExceptionPage(); 35 | } 36 | else 37 | { 38 | app.UseExceptionHandler("/Home/Error"); 39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 40 | app.UseHsts(); 41 | } 42 | // app.UseHttpsRedirection(); 43 | app.UseStaticFiles(); 44 | 45 | app.UseRouting(); 46 | 47 | app.UseAuthorization(); 48 | 49 | app.UseEndpoints(endpoints => 50 | { 51 | endpoints.MapControllerRoute( 52 | name: "default", 53 | pattern: "{controller=Home}/{action=Index}/{id?}"); 54 | }); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
    6 |

    Welcome

    7 |
    8 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Product/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Product List"; 3 | } 4 | 5 |
    6 |

    Product List

    7 |
    8 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Product/PriceUpdate.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Price Update"; 5 | } 6 | 7 |

    @ViewData["Title"]

    8 | 9 |
    10 |
    11 |
    12 |
    13 |
    14 |
    15 |
    16 |
    17 | 18 |
    19 | 20 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | 27 | 28 |
    29 |
    30 |
    31 | 32 |
    33 | 34 | 35 |
    36 |
    37 |
    38 | 39 |
    40 | 41 | 42 |
    43 |
    44 |
    45 | 46 |
    47 | 48 | 49 |
    50 |
    51 | 52 |
    53 | 54 |
    55 |
    56 |
    57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | @if (ViewBag.IsAcceptable != null && ViewBag.IsAcceptable) 69 | { 70 | 74 | } 75 | else 76 | { 77 | 81 | } 82 | 83 | 84 | 85 | 86 |
    Minimim Required Profit MarginCalculated Profit Margin
    66 | 40% 67 | 72 | @ViewBag.CalculateMargin% 73 | 79 | @ViewBag.CalculateMargin% 80 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 | 93 |
    94 |
    95 |
    96 | 101 | 108 |
    109 |
    110 | 111 |
    112 |
    113 | 119 | 126 |
    127 | 128 |
    129 |
    130 |
    131 |
    132 |
    133 | 134 | @section Scripts { 135 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} 136 | } 137 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Product/ProductList.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductListViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Product List"; 5 | } 6 | 7 |

    @ViewData["Title"]

    8 | 9 | 10 | 11 | 14 | 17 | 20 | 23 | 26 | 27 | 28 | @foreach (var product in Model.products) 29 | { 30 | 31 | 34 | 37 | 40 | 42 | 45 | 50 | 51 | } 52 |
    12 | Name 13 | 15 | Current Cost 16 | 18 | Current Price 19 | 21 | Current Margin 22 | 24 | Last Effective Date 25 |
    32 | @Html.DisplayFor(modelItem => product.Name) 33 | 35 | @Html.DisplayFor(modelItem => product.Cost) 36 | 38 | @Html.DisplayFor(modelItem => product.Price) 39 | 41 | 43 | @Html.DisplayFor(modelItem => product.EffectiveDate) 44 | 46 | @Html.ActionLink("Edit", "Edit", new { id = product.Id }) | 47 | @Html.ActionLink("Details", "Details", new { id = product.Id }) | 48 | @Html.ActionLink("Delete", "Delete", new { id = product.Id }) 49 |
    53 | 54 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - Acme Product Management 7 | 8 | 9 | 10 | 11 |
    12 | 34 |
    35 |
    36 |
    37 | @RenderBody() 38 |
    39 |
    40 | 41 |
    42 |
    43 | © 2019 - APM.MVC - Privacy 44 |
    45 |
    46 | 47 | 48 | 49 | @RenderSection("Scripts", required: false) 50 | 51 | 52 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using APM.MVC 2 | @using APM.MVC.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/css/site.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 | /* Provide sufficient contrast against white background */ 11 | a { 12 | color: #0366d6; 13 | } 14 | 15 | .btn-primary { 16 | color: #fff; 17 | background-color: #1b6ec2; 18 | border-color: #1861ac; 19 | } 20 | 21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 22 | color: #fff; 23 | background-color: #1b6ec2; 24 | border-color: #1861ac; 25 | } 26 | 27 | /* Sticky footer styles 28 | -------------------------------------------------- */ 29 | html { 30 | font-size: 14px; 31 | } 32 | @media (min-width: 768px) { 33 | html { 34 | font-size: 16px; 35 | } 36 | } 37 | 38 | .border-top { 39 | border-top: 1px solid #e5e5e5; 40 | } 41 | .border-bottom { 42 | border-bottom: 1px solid #e5e5e5; 43 | } 44 | 45 | .box-shadow { 46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 47 | } 48 | 49 | button.accept-policy { 50 | font-size: 1rem; 51 | line-height: inherit; 52 | } 53 | 54 | /* Sticky footer styles 55 | -------------------------------------------------- */ 56 | html { 57 | position: relative; 58 | min-height: 100%; 59 | } 60 | 61 | body { 62 | /* Margin bottom by footer height */ 63 | margin-bottom: 60px; 64 | } 65 | .footer { 66 | position: absolute; 67 | bottom: 0; 68 | width: 100%; 69 | white-space: nowrap; 70 | line-height: 60px; /* Vertically center the text there */ 71 | } 72 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-Final/APM.MVC/wwwroot/favicon.ico -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/js/site.js: -------------------------------------------------------------------------------- 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 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2018 Twitter, Inc. 4 | Copyright (c) 2011-2018 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 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { 22 | display: block; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 28 | font-size: 1rem; 29 | font-weight: 400; 30 | line-height: 1.5; 31 | color: #212529; 32 | text-align: left; 33 | background-color: #fff; 34 | } 35 | 36 | [tabindex="-1"]:focus { 37 | outline: 0 !important; 38 | } 39 | 40 | hr { 41 | box-sizing: content-box; 42 | height: 0; 43 | overflow: visible; 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | margin-top: 0; 48 | margin-bottom: 0.5rem; 49 | } 50 | 51 | p { 52 | margin-top: 0; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | abbr[title], 57 | abbr[data-original-title] { 58 | text-decoration: underline; 59 | -webkit-text-decoration: underline dotted; 60 | text-decoration: underline dotted; 61 | cursor: help; 62 | border-bottom: 0; 63 | -webkit-text-decoration-skip-ink: none; 64 | text-decoration-skip-ink: none; 65 | } 66 | 67 | address { 68 | margin-bottom: 1rem; 69 | font-style: normal; 70 | line-height: inherit; 71 | } 72 | 73 | ol, 74 | ul, 75 | dl { 76 | margin-top: 0; 77 | margin-bottom: 1rem; 78 | } 79 | 80 | ol ol, 81 | ul ul, 82 | ol ul, 83 | ul ol { 84 | margin-bottom: 0; 85 | } 86 | 87 | dt { 88 | font-weight: 700; 89 | } 90 | 91 | dd { 92 | margin-bottom: .5rem; 93 | margin-left: 0; 94 | } 95 | 96 | blockquote { 97 | margin: 0 0 1rem; 98 | } 99 | 100 | b, 101 | strong { 102 | font-weight: bolder; 103 | } 104 | 105 | small { 106 | font-size: 80%; 107 | } 108 | 109 | sub, 110 | sup { 111 | position: relative; 112 | font-size: 75%; 113 | line-height: 0; 114 | vertical-align: baseline; 115 | } 116 | 117 | sub { 118 | bottom: -.25em; 119 | } 120 | 121 | sup { 122 | top: -.5em; 123 | } 124 | 125 | a { 126 | color: #007bff; 127 | text-decoration: none; 128 | background-color: transparent; 129 | } 130 | 131 | a:hover { 132 | color: #0056b3; 133 | text-decoration: underline; 134 | } 135 | 136 | a:not([href]):not([tabindex]) { 137 | color: inherit; 138 | text-decoration: none; 139 | } 140 | 141 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 142 | color: inherit; 143 | text-decoration: none; 144 | } 145 | 146 | a:not([href]):not([tabindex]):focus { 147 | outline: 0; 148 | } 149 | 150 | pre, 151 | code, 152 | kbd, 153 | samp { 154 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 155 | font-size: 1em; 156 | } 157 | 158 | pre { 159 | margin-top: 0; 160 | margin-bottom: 1rem; 161 | overflow: auto; 162 | } 163 | 164 | figure { 165 | margin: 0 0 1rem; 166 | } 167 | 168 | img { 169 | vertical-align: middle; 170 | border-style: none; 171 | } 172 | 173 | svg { 174 | overflow: hidden; 175 | vertical-align: middle; 176 | } 177 | 178 | table { 179 | border-collapse: collapse; 180 | } 181 | 182 | caption { 183 | padding-top: 0.75rem; 184 | padding-bottom: 0.75rem; 185 | color: #6c757d; 186 | text-align: left; 187 | caption-side: bottom; 188 | } 189 | 190 | th { 191 | text-align: inherit; 192 | } 193 | 194 | label { 195 | display: inline-block; 196 | margin-bottom: 0.5rem; 197 | } 198 | 199 | button { 200 | border-radius: 0; 201 | } 202 | 203 | button:focus { 204 | outline: 1px dotted; 205 | outline: 5px auto -webkit-focus-ring-color; 206 | } 207 | 208 | input, 209 | button, 210 | select, 211 | optgroup, 212 | textarea { 213 | margin: 0; 214 | font-family: inherit; 215 | font-size: inherit; 216 | line-height: inherit; 217 | } 218 | 219 | button, 220 | input { 221 | overflow: visible; 222 | } 223 | 224 | button, 225 | select { 226 | text-transform: none; 227 | } 228 | 229 | select { 230 | word-wrap: normal; 231 | } 232 | 233 | button, 234 | [type="button"], 235 | [type="reset"], 236 | [type="submit"] { 237 | -webkit-appearance: button; 238 | } 239 | 240 | button:not(:disabled), 241 | [type="button"]:not(:disabled), 242 | [type="reset"]:not(:disabled), 243 | [type="submit"]:not(:disabled) { 244 | cursor: pointer; 245 | } 246 | 247 | button::-moz-focus-inner, 248 | [type="button"]::-moz-focus-inner, 249 | [type="reset"]::-moz-focus-inner, 250 | [type="submit"]::-moz-focus-inner { 251 | padding: 0; 252 | border-style: none; 253 | } 254 | 255 | input[type="radio"], 256 | input[type="checkbox"] { 257 | box-sizing: border-box; 258 | padding: 0; 259 | } 260 | 261 | input[type="date"], 262 | input[type="time"], 263 | input[type="datetime-local"], 264 | input[type="month"] { 265 | -webkit-appearance: listbox; 266 | } 267 | 268 | textarea { 269 | overflow: auto; 270 | resize: vertical; 271 | } 272 | 273 | fieldset { 274 | min-width: 0; 275 | padding: 0; 276 | margin: 0; 277 | border: 0; 278 | } 279 | 280 | legend { 281 | display: block; 282 | width: 100%; 283 | max-width: 100%; 284 | padding: 0; 285 | margin-bottom: .5rem; 286 | font-size: 1.5rem; 287 | line-height: inherit; 288 | color: inherit; 289 | white-space: normal; 290 | } 291 | 292 | progress { 293 | vertical-align: baseline; 294 | } 295 | 296 | [type="number"]::-webkit-inner-spin-button, 297 | [type="number"]::-webkit-outer-spin-button { 298 | height: auto; 299 | } 300 | 301 | [type="search"] { 302 | outline-offset: -2px; 303 | -webkit-appearance: none; 304 | } 305 | 306 | [type="search"]::-webkit-search-decoration { 307 | -webkit-appearance: none; 308 | } 309 | 310 | ::-webkit-file-upload-button { 311 | font: inherit; 312 | -webkit-appearance: button; 313 | } 314 | 315 | output { 316 | display: inline-block; 317 | } 318 | 319 | summary { 320 | display: list-item; 321 | cursor: pointer; 322 | } 323 | 324 | template { 325 | display: none; 326 | } 327 | 328 | [hidden] { 329 | display: none !important; 330 | } 331 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/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}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}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:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[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}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | // Unobtrusive validation support library for jQuery and jQuery Validate 2 | // Copyright (c) .NET Foundation. All rights reserved. 3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 4 | // @version v3.2.11 5 | !function(a){"function"==typeof define&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery-validation")):jQuery.validator.unobtrusive=a(jQuery)}(function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a("
  • ").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function u(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=f.unobtrusive.options||{},u=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),u("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),u("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),u("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var m,f=a.validator,v="unobtrusiveValidation";return f.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=u(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){f.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=u(this);a&&a.attachValidation()})}},m=f.unobtrusive.adapters,m.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},m.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},m.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},m.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},f.addMethod("__dummy__",function(a,e,n){return!0}),f.addMethod("regex",function(a,e,n){var t;return!!this.optional(e)||(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),f.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),f.methods.extension?(m.addSingleVal("accept","mimtype"),m.addSingleVal("extension","extension")):m.addSingleVal("extension","extension","accept"),m.addSingleVal("regex","pattern"),m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),m.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),m.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),m.add("required",function(a){"INPUT"===a.element.tagName.toUpperCase()&&"CHECKBOX"===a.element.type.toUpperCase()||e(a,"required",!0)}),m.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),m.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),m.add("fileextensions",["extensions"],function(a){e(a,"extension",a.params.extensions)}),a(function(){f.unobtrusive.parse(document)}),f.unobtrusive}); -------------------------------------------------------------------------------- /APM-Final/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-Final/APM.MVC/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright JS Foundation and other contributors, https://js.foundation/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /APM-Final/APM.SL.Test/APM.SL.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL.Test 6 | enable 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /APM-Final/APM.SL.Test/DiscountTest.cs: -------------------------------------------------------------------------------- 1 | using APM.Utilities; 2 | using System; 3 | using System.Collections.Generic; 4 | using Xunit; 5 | 6 | namespace APM.SL.Test 7 | { 8 | public class DiscountTest 9 | { 10 | // 11 | // FindDiscount 12 | // 13 | [Fact] 14 | public void FindDiscount_WhenListIsNull_ShouldReturnNull() 15 | { 16 | // Arrange 17 | List? discounts = null; 18 | var discountName = "40% off"; 19 | Discount? expected = null; 20 | var discount = new Discount(); 21 | 22 | // Act 23 | var actual = discount.FindDiscount(discounts, discountName); 24 | 25 | // Assert 26 | Assert.Equal(expected, actual); 27 | } 28 | 29 | [Fact] 30 | public void FindDiscountWithException_WhenListIsNull_ShouldThrow() 31 | { 32 | // Arrange 33 | List? discounts = null; 34 | var discountName = "40% off"; 35 | var discount = new Discount(); 36 | 37 | // Act & Assert 38 | var ex = Assert.Throws(() => discount.FindDiscountWithException(discounts, discountName)); 39 | Assert.Equal("No discounts found", ex.Message); 40 | } 41 | 42 | [Fact] 43 | public void FindDiscountWithException_WhenNotFound_ShouldReturnNotFound() 44 | { 45 | // Arrange 46 | List? discounts = new List(); 47 | var discountName = "40% off"; 48 | var discount = new Discount(); 49 | 50 | // Act & Assert 51 | var ex = Assert.Throws(() => discount.FindDiscountWithException(discounts, discountName)); 52 | Assert.Equal("Discount not found", ex.Message); 53 | } 54 | 55 | [Fact] 56 | public void FindDiscountWithTuple_WhenListIsNull_ShouldReturnNull() 57 | { 58 | // Arrange 59 | List? discounts = null; 60 | var discountName = "40% off"; 61 | (Discount? Discount, string? Message) expected = (Discount: null, Message: "No discounts found"); 62 | var discount = new Discount(); 63 | 64 | // Act 65 | var actual = discount.FindDiscountWithTuple(discounts, discountName); 66 | 67 | // Assert 68 | Assert.Equal(expected, actual); 69 | } 70 | 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /APM-Final/APM.SL.Test/ProductTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-Final/APM.SL.Test/ProductTest.cs -------------------------------------------------------------------------------- /APM-Final/APM.SL/APM.SL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /APM-Final/APM.SL/Discount.cs: -------------------------------------------------------------------------------- 1 | using APM.Utilities; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace APM.SL 6 | { 7 | public class Discount 8 | { 9 | public int DiscountId { get; private set; } 10 | public string DiscountName { get; set; } = ""; 11 | 12 | public decimal? PercentOff { get; set; } 13 | 14 | // ... Discount details 15 | 16 | public Discount? FindDiscount(List? discounts, string discountName) 17 | { 18 | if (discounts is null) return null; 19 | 20 | var foundDiscount = discounts.Find(d => d.DiscountName == discountName); 21 | 22 | return foundDiscount; 23 | } 24 | 25 | public Discount FindDiscountWithException(List? discounts, string discountName) 26 | { 27 | if (discounts is null) 28 | throw new ArgumentException("No discounts found"); 29 | 30 | var foundDiscount = discounts.Find(d => d.DiscountName == discountName); 31 | 32 | if (foundDiscount is null) 33 | throw new DiscountNotFoundException("Discount not found"); 34 | 35 | return foundDiscount; 36 | } 37 | 38 | public (Discount? Discount, string? Message) FindDiscountWithTuple(List? discounts, string discountName) 39 | { 40 | if (discounts is null) 41 | return (Discount: null, Message: "No discounts found"); 42 | 43 | var foundDiscount = 44 | discounts.Find(d => d.DiscountName == discountName); 45 | 46 | if (foundDiscount is null) 47 | return (Discount: null, Message: "Discount not found"); 48 | 49 | return (Discount: foundDiscount, Message: null); 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /APM-Final/APM.SL/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace APM.SL 5 | { 6 | public class Product 7 | { 8 | // Value Types 9 | public DateTime? EffectiveDate { get; set; } 10 | public decimal Cost { get; set; } 11 | public decimal Price { get; set; } 12 | public int ProductId { get; set; } 13 | 14 | // Reference Types 15 | public string Category { get; set; } = ""; 16 | 17 | public List? Discounts { get; set; } 18 | 19 | public Discount? ProductDiscount { get; set; } 20 | 21 | public string ProductName { get; set; } = ""; 22 | 23 | public string Reason { get; set; } = ""; 24 | 25 | 26 | /// 27 | /// Calculate the potential profit margin. 28 | /// 29 | /// Cost in dollars and cents (from user input as string) 30 | /// Suggested price in dollars and cents (from user input as string) 31 | /// Resulting profit margin 32 | public decimal CalculateMargin(string costInput, string priceInput) 33 | { 34 | Guard.ThrowIfNullOrEmpty(costInput, "Please enter the cost", "cost"); 35 | Guard.ThrowIfNullOrEmpty(priceInput, "Please enter the price", "price"); 36 | 37 | var cost = Guard.ThrowIfNotPositiveDecimal(costInput, 38 | "The cost must be a number 0 or greater", "cost"); 39 | var price = Guard.ThrowIfNotPositiveNonZeroDecimal(priceInput, 40 | "The price must be a number greater than 0", "price"); 41 | 42 | var margin = Math.Round(((price - cost) / price) * 100M); 43 | 44 | return margin; 45 | } 46 | 47 | public decimal CalculateMarginWithGuardClassOriginal(string costInput, string priceInput) 48 | { 49 | Guard.ThrowIfNullOrEmpty(costInput, "Please enter the cost", "cost"); 50 | Guard.ThrowIfNullOrEmpty(priceInput, "Please enter the price", "price"); 51 | 52 | var cost = Guard.ThrowIfNotPositiveDecimal(costInput!, "The cost must be a number 0 or greater", "cost"); 53 | var price = Guard.ThrowIfNotPositiveNonZeroDecimal(priceInput, "The price must be a number greater than 0", "price"); 54 | 55 | var margin = Math.Round(((price - cost) / price) * 100M); 56 | 57 | return margin; 58 | } 59 | 60 | public decimal CalculateMarginWithOverload(string costInput, string priceInput) 61 | { 62 | if (string.IsNullOrWhiteSpace(costInput)) throw new ArgumentException("Please enter the cost"); 63 | if (string.IsNullOrWhiteSpace(priceInput)) throw new ArgumentException("Please enter the price"); 64 | 65 | var success = decimal.TryParse(costInput, out decimal cost); 66 | if (!success || cost < 0) throw new ArgumentException("The cost must be a number 0 or greater"); 67 | 68 | success = decimal.TryParse(priceInput, out decimal price); 69 | if (!success || price <= 0) throw new ArgumentException("The price must be a number greater than 0"); 70 | 71 | return CalculateMarginWithOverload(cost, price); 72 | } 73 | 74 | private decimal CalculateMarginWithOverload(decimal cost, decimal price) 75 | { 76 | // if (price == 0) throw new ArgumentException("The price must not be 0"); 77 | 78 | var margin = Math.Round(((price - cost) / price) * 100M); 79 | 80 | return margin; 81 | } 82 | 83 | public decimal CalculateMarginWithGuardClauses(string costInput, string priceInput) 84 | { 85 | if (string.IsNullOrWhiteSpace(costInput)) throw new ArgumentException("Please enter the cost", "cost"); 86 | if (string.IsNullOrWhiteSpace(priceInput)) throw new ArgumentException("Please enter the price", "price"); 87 | 88 | var success = decimal.TryParse(costInput, out decimal cost); 89 | if (!success || cost < 0) throw new ArgumentException("The cost must be a number 0 or greater", "cost"); 90 | 91 | success = decimal.TryParse(priceInput, out decimal price); 92 | if (!success || price <= 0) throw new ArgumentException("The price must be a number greater than 0", "price"); 93 | 94 | var margin = Math.Round(((price - cost) / price) * 100M); 95 | 96 | return margin; 97 | } 98 | 99 | public decimal CalculateMarginWithSurroundingConditionals(string costInput, string priceInput) 100 | { 101 | var success = decimal.TryParse(costInput, out decimal cost); 102 | 103 | decimal margin = 0; 104 | if (success) 105 | { 106 | success = decimal.TryParse(priceInput, out decimal price); 107 | 108 | if (success && price > 0) 109 | { 110 | margin = Math.Round(((price - cost) / price) * 100M); 111 | } 112 | } 113 | 114 | return margin; 115 | } 116 | 117 | public decimal CalculateMarginOriginal(string costInput, string priceInput) 118 | { 119 | decimal cost = decimal.Parse(costInput); 120 | decimal price = decimal.Parse(priceInput); 121 | 122 | var margin = Math.Round(((price - cost) / price) * 100M); 123 | 124 | return margin; 125 | } 126 | 127 | public (decimal? Margin, string? Message) CalculateMarginTuple(string costInput, string priceInput) 128 | { 129 | if (string.IsNullOrWhiteSpace(costInput)) 130 | return (Margin: null, Message: "Please enter the cost"); 131 | if (string.IsNullOrWhiteSpace(priceInput)) 132 | return (Margin: null, Message: "Please enter the price"); 133 | 134 | var success = decimal.TryParse(costInput, out decimal cost); 135 | if (!success || cost < 0) 136 | return (Margin: null, Message: "The cost must be a number 0 or greater"); 137 | 138 | success = decimal.TryParse(priceInput, out decimal price); 139 | if (!success || price <= 0) 140 | return (Margin: null, Message: "The price must be a number greater than 0"); 141 | 142 | var margin = Math.Round(((price - cost) / price) * 100M); 143 | return (Margin: margin, Message: null); 144 | } 145 | 146 | 147 | /// 148 | /// Calculates the total amount of the discount 149 | /// 150 | /// 151 | public decimal CalculateTotalDiscount(decimal price, Discount discount) 152 | { 153 | if (price <= 0) throw new ArgumentException("Please enter the price"); 154 | 155 | if (discount?.PercentOff is null) throw new ArgumentException("Please specify a discount"); 156 | 157 | var discountAmount = price * (discount.PercentOff.Value / 100); 158 | 159 | return discountAmount; 160 | } 161 | 162 | 163 | /// 164 | /// Saves pricing details. 165 | /// 166 | /// 167 | public bool SavePrice(int productId, string cost, string price, 168 | string category, string reason, 169 | DateTime effectiveDate) 170 | { 171 | // Generates a warning if nullable is set to "warnings" 172 | // string name = null; 173 | // Console.WriteLine(name.Length); 174 | 175 | // To turn off unused parameter warnings 176 | Utility.LogToFile(new string[] { "Price Saved:", productId.ToString(), cost, price, category, reason, effectiveDate.ToString() }); 177 | 178 | // Validate arguments 179 | // Calls a method in the data layer to save the data... 180 | 181 | return true; 182 | } 183 | 184 | public (bool Success, string Message) SavePriceWithTuple(int productId, 185 | string cost, string price, 186 | string category, string reason, 187 | DateTime effectiveDate) 188 | { 189 | // To turn off unused parameter warnings 190 | Console.WriteLine(new string[] { productId.ToString(), cost, price, category, reason, effectiveDate.ToString() }); 191 | 192 | // Validate arguments 193 | // Call a method in the data layer to save the data... 194 | 195 | return (Success: true, Message: "Price saved successfully"); 196 | } 197 | 198 | public OperationResult SavePriceWithObject(int productId, 199 | string cost, string price, 200 | string category, string reason, 201 | DateTime effectiveDate) 202 | { 203 | // To turn off unused parameter warnings 204 | Console.WriteLine(new string[] { productId.ToString(), cost, price, category, reason, effectiveDate.ToString() }); 205 | 206 | // Validate arguments 207 | // Call a method in the data layer to save the data... 208 | 209 | return new OperationResult() { Success = true, ValidationMessage = "Price saved successfully" }; 210 | } 211 | 212 | /// 213 | /// Validates the effective data according to two rules: 214 | /// - Effective date is required 215 | /// - Effective date is one week (or more) beyond the current date 216 | /// 217 | /// 218 | /// 219 | public bool ValidateEffectiveDate(DateTime? effectiveDate) 220 | { 221 | if (!effectiveDate.HasValue) return false; 222 | 223 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return false; 224 | 225 | return true; 226 | } 227 | 228 | public bool ValidateEffectiveDateWithRef(DateTime? effectiveDate, ref string validationMessage) 229 | { 230 | if (!effectiveDate.HasValue) 231 | { 232 | validationMessage = "Date has no value"; 233 | return false; 234 | }; 235 | 236 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) 237 | { 238 | validationMessage = "Date must be at least 7 days from today"; 239 | return false; 240 | } 241 | 242 | return true; 243 | } 244 | 245 | public bool ValidateEffectiveDateWithOut(DateTime? effectiveDate, out string validationMessage) 246 | { 247 | validationMessage = ""; 248 | if (!effectiveDate.HasValue) 249 | { 250 | validationMessage = "Date has no value"; 251 | return false; 252 | }; 253 | 254 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) 255 | { 256 | validationMessage = "Date must be at least 7 days from today"; 257 | return false; 258 | } 259 | 260 | return true; 261 | } 262 | 263 | public (bool IsValid, string ValidationMessage) ValidateEffectiveDateWithTuple(DateTime? effectiveDate) 264 | { 265 | if (!effectiveDate.HasValue) return (IsValid: false, ValidationMessage: "Date has no value"); 266 | 267 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return (false, "Date must be at least 7 days from today"); 268 | 269 | return (IsValid: true, ValidationMessage: ""); 270 | } 271 | 272 | public OperationResult ValidateEffectiveDateWithObject(DateTime? effectiveDate) 273 | { 274 | if (!effectiveDate.HasValue) return new OperationResult() 275 | { Success = false, ValidationMessage = "Date has no value" }; 276 | 277 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) return new OperationResult() 278 | { Success = false, ValidationMessage = "Date must be at least 7 days from today" }; 279 | 280 | return new OperationResult() { Success = true }; 281 | } 282 | 283 | public bool ValidateEffectiveDateWithException(DateTime? effectiveDate) 284 | { 285 | if (!effectiveDate.HasValue) throw new ArgumentException("Please enter the effective date"); 286 | 287 | if (effectiveDate.Value < DateTime.Now.AddDays(7)) throw new ArgumentException("Date must be at least 7 days from today"); 288 | 289 | return true; 290 | } 291 | } 292 | } 293 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities.Test/APM.Utilities.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | enable 6 | 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities.Test/EmailTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace APM.SL.Test 5 | { 6 | public class EmailTest 7 | { 8 | [Fact] 9 | public void SendEmail_WhenValidValues_ShouldReturnTrue() 10 | { 11 | // Arrange 12 | var expected = true; 13 | 14 | // Act 15 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 16 | "Please confirm our 1PM meeting", 17 | DateTime.Now); 18 | 19 | // Assert 20 | Assert.Equal(expected, actual); 21 | } 22 | 23 | [Fact] 24 | public void SendEmail_WhenOptionalValues_ShouldReturnTrue() 25 | { 26 | // Arrange 27 | var expected = true; 28 | 29 | // Act 30 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 31 | "Please confirm our 1PM meeting", 32 | DateTime.Now, 33 | saveCopy: true, highPriority:true, 34 | includeSignature: false); 35 | 36 | // Assert 37 | Assert.Equal(expected, actual); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # IDE0063: Use simple 'using' statement 4 | csharp_prefer_simple_using_statement = false:suggestion 5 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/APM.Utilities.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/DiscountNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.Utilities 6 | { 7 | [Serializable()] 8 | public class DiscountNotFoundException : System.Exception 9 | { 10 | public DiscountNotFoundException() : base() { } 11 | 12 | public DiscountNotFoundException(string message) : base(message) { } 13 | 14 | public DiscountNotFoundException(string message, Exception inner) : base(message, inner) { } 15 | 16 | protected DiscountNotFoundException(System.Runtime.Serialization.SerializationInfo info, 17 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/Guard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Guard 8 | { 9 | public static void ThrowIfNullOrEmpty(string argumentValue, string message, string parameterName) 10 | { 11 | if (string.IsNullOrWhiteSpace(argumentValue)) throw new ValidationException(message, parameterName); 12 | } 13 | 14 | public static decimal ThrowIfNotPositiveDecimal(string argumentValue, string message, string parameterName) 15 | { 16 | var success = decimal.TryParse(argumentValue, out decimal result); 17 | if (!success || result < 0) throw new ArgumentException(message, parameterName); 18 | 19 | return result; 20 | } 21 | 22 | public static decimal ThrowIfNotPositiveNonZeroDecimal(string argumentValue, string message, string parameterName) 23 | { 24 | var success = decimal.TryParse(argumentValue, out decimal result); 25 | if (!success || result <= 0) throw new ArgumentException(message, parameterName); 26 | 27 | return result; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/OperationResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public class OperationResult 8 | { 9 | public bool Success { get; set; } 10 | public string ValidationMessage { get; set; } 11 | 12 | public OperationResult() 13 | { 14 | ValidationMessage = ""; 15 | Success = false; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Utility 8 | { 9 | public static bool SendEmail(string recipient, string subject, 10 | string body, DateTime sendDate, 11 | bool saveCopy = false, bool highPriority = false, 12 | bool includeSignature = true) 13 | { 14 | // Send email 15 | Utility.LogToFile(new string[] { "Email sent:", recipient, subject, body, sendDate.ToShortDateString(), 16 | saveCopy.ToString(), highPriority.ToString(), includeSignature.ToString() }); 17 | 18 | return true; 19 | } 20 | 21 | public static void LogToFile(string[] textToLog) 22 | { 23 | string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 24 | 25 | if (String.IsNullOrEmpty(docPath)) throw new InvalidOperationException("Path cannot be null"); 26 | 27 | using (StreamWriter w = File.AppendText(Path.Combine(docPath, "log.txt"))) 28 | { 29 | w.WriteLine(""); 30 | w.Write("Log Entry: "); 31 | w.WriteLine($"{DateTime.Now.ToLongTimeString()}"); 32 | foreach (var logText in textToLog) 33 | w.WriteLine($" - {logText}"); 34 | w.WriteLine("-------------------------------"); 35 | } 36 | } 37 | 38 | public static string RemoveParenthetical(this String text) 39 | { 40 | return Regex.Replace(text, @"\(.*\)", ""); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /APM-Final/APM.Utilities/ValidationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.SL 4 | { 5 | [Serializable()] 6 | public class ValidationException : System.ArgumentException 7 | { 8 | public ValidationException() : base() { } 9 | 10 | public ValidationException(string message) : base(message) { } 11 | 12 | public ValidationException(string message, string paramName) : base(message, paramName) { } 13 | 14 | public ValidationException(string message, Exception inner) : base(message, inner) { } 15 | 16 | protected ValidationException(System.Runtime.Serialization.SerializationInfo info, 17 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /APM-Final/APM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29326.143 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL", "APM.SL\APM.SL.csproj", "{7D10D82E-2BD9-4626-95F4-5979D5F0A66F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL.Test", "APM.SL.Test\APM.SL.Test.csproj", "{C332BD2C-D120-42F9-90D8-106AFAD4C1CE}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities", "APM.Utilities\APM.Utilities.csproj", "{1291C026-36DC-48A0-94C9-7C4C934E9C18}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities.Test", "APM.Utilities.Test\APM.Utilities.Test.csproj", "{80F03195-553E-49F2-909F-05D50F26E59A}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.MVC", "APM.MVC\APM.MVC.csproj", "{DA04EDBA-AA99-4411-AD76-33868604835D}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {5330F312-3A35-4D4E-B981-96659E196D29} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/APM.MVC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers; buildtransitive 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using APM.MVC.Models; 9 | 10 | namespace APM.MVC.Controllers 11 | { 12 | public class HomeController : Controller 13 | { 14 | private readonly ILogger _logger; 15 | 16 | public HomeController(ILogger logger) 17 | { 18 | _logger = logger; 19 | } 20 | 21 | public IActionResult Index() 22 | { 23 | return View(); 24 | } 25 | 26 | public IActionResult Privacy() 27 | { 28 | return View(); 29 | } 30 | 31 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 32 | public IActionResult Error() 33 | { 34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using APM.MVC.Models; 2 | using APM.SL; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | 6 | namespace APM.MVC.Controllers 7 | { 8 | public class ProductController : Controller 9 | { 10 | 11 | // GET action 12 | // When navigating to the page. 13 | public IActionResult PriceUpdate() 14 | { 15 | // Create model 16 | var productVM = new ProductViewModel(); 17 | productVM.EffectiveDate = DateTime.Now; 18 | 19 | ViewBag.IsAcceptable = false; 20 | 21 | return View(productVM); 22 | } 23 | 24 | [HttpPost] 25 | [ValidateAntiForgeryToken] 26 | public IActionResult PriceUpdate(ProductViewModel productVM) 27 | { 28 | // Code to save the product 29 | 30 | return View(nameof(Index)); 31 | } 32 | 33 | [HttpPost] 34 | [ValidateAntiForgeryToken] 35 | public IActionResult Calculate(ProductViewModel productVM) 36 | { 37 | var price = productVM.Price; 38 | var cost = productVM.Cost; 39 | 40 | decimal calculatedMargin = 0; 41 | try 42 | { 43 | 44 | // Calculate and check the profit margin 45 | var product = new Product(); 46 | calculatedMargin = product.CalculateMargin(cost, price); 47 | } 48 | catch (ValidationException ex) when (ex.ParamName == "cost") 49 | { 50 | ModelState.AddModelError("Cost", ex.Message.RemoveParenthetical()); 51 | } 52 | catch (ValidationException ex) when (ex.ParamName == "price") 53 | { 54 | ModelState.AddModelError("Price", ex.Message.RemoveParenthetical()); 55 | } 56 | 57 | // Display the results 58 | ViewBag.CalculateMargin = calculatedMargin; 59 | ViewBag.IsAcceptable = calculatedMargin >= 40; 60 | 61 | return View(nameof(PriceUpdate), productVM); 62 | } 63 | 64 | // GET: Product 65 | public ActionResult Index() 66 | { 67 | return View(); 68 | } 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.MVC.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Models/PricingDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace APM.MVC.Models 8 | { 9 | public class ProductViewModel 10 | { 11 | public string Category { get; set; } 12 | public string Cost { get; set; } 13 | public int Id { get; private set; } 14 | 15 | [DataType(DataType.Date)] 16 | [DisplayFormat(DataFormatString = "{0:d}")] 17 | public DateTimeOffset EffectiveDate { get; set; } 18 | 19 | public string Name { get; set; } 20 | 21 | public string Price { get; set; } 22 | public string Reason { get; set; } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Models/ProductListViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace APM.MVC.Models 7 | { 8 | public class ProductListViewModel 9 | { 10 | public List products { get; set; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace APM.MVC 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.HttpsPolicy; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Hosting; 11 | 12 | namespace APM.MVC 13 | { 14 | public class Startup 15 | { 16 | public Startup(IConfiguration configuration) 17 | { 18 | Configuration = configuration; 19 | } 20 | 21 | public IConfiguration Configuration { get; } 22 | 23 | // This method gets called by the runtime. Use this method to add services to the container. 24 | public void ConfigureServices(IServiceCollection services) 25 | { 26 | services.AddControllersWithViews(); 27 | } 28 | 29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 31 | { 32 | if (env.IsDevelopment()) 33 | { 34 | app.UseDeveloperExceptionPage(); 35 | } 36 | else 37 | { 38 | app.UseExceptionHandler("/Home/Error"); 39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 40 | app.UseHsts(); 41 | } 42 | // app.UseHttpsRedirection(); 43 | app.UseStaticFiles(); 44 | 45 | app.UseRouting(); 46 | 47 | app.UseAuthorization(); 48 | 49 | app.UseEndpoints(endpoints => 50 | { 51 | endpoints.MapControllerRoute( 52 | name: "default", 53 | pattern: "{controller=Home}/{action=Index}/{id?}"); 54 | }); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
    6 |

    Welcome

    7 |
    8 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Product/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Product List"; 3 | } 4 | 5 |
    6 |

    Product List

    7 |
    8 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Product/PriceUpdate.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Price Update"; 5 | } 6 | 7 |

    @ViewData["Title"]

    8 | 9 |
    10 |
    11 |
    12 |
    13 |
    14 |
    15 |
    16 |
    17 | 18 |
    19 | 20 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | 27 | 28 |
    29 |
    30 |
    31 | 32 |
    33 | 34 | 35 |
    36 |
    37 |
    38 | 39 |
    40 | 41 | 42 |
    43 |
    44 |
    45 | 46 |
    47 | 48 | 49 |
    50 |
    51 | 52 |
    53 | 54 |
    55 |
    56 |
    57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | @if (ViewBag.IsAcceptable != null && ViewBag.IsAcceptable) 69 | { 70 | 74 | } 75 | else 76 | { 77 | 81 | } 82 | 83 | 84 | 85 | 86 |
    Minimim Required Profit MarginCalculated Profit Margin
    66 | 40% 67 | 72 | @ViewBag.CalculateMargin% 73 | 79 | @ViewBag.CalculateMargin% 80 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 | 93 |
    94 |
    95 |
    96 | 101 | 108 |
    109 |
    110 | 111 |
    112 |
    113 | 119 | 126 |
    127 | 128 |
    129 |
    130 |
    131 |
    132 |
    133 | 134 | @section Scripts { 135 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} 136 | } 137 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Product/ProductList.cshtml: -------------------------------------------------------------------------------- 1 | @model APM.MVC.Models.ProductListViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Product List"; 5 | } 6 | 7 |

    @ViewData["Title"]

    8 | 9 | 10 | 11 | 14 | 17 | 20 | 23 | 26 | 27 | 28 | @foreach (var product in Model.products) 29 | { 30 | 31 | 34 | 37 | 40 | 42 | 45 | 50 | 51 | } 52 |
    12 | Name 13 | 15 | Current Cost 16 | 18 | Current Price 19 | 21 | Current Margin 22 | 24 | Last Effective Date 25 |
    32 | @Html.DisplayFor(modelItem => product.Name) 33 | 35 | @Html.DisplayFor(modelItem => product.Cost) 36 | 38 | @Html.DisplayFor(modelItem => product.Price) 39 | 41 | 43 | @Html.DisplayFor(modelItem => product.EffectiveDate) 44 | 46 | @Html.ActionLink("Edit", "Edit", new { id = product.Id }) | 47 | @Html.ActionLink("Details", "Details", new { id = product.Id }) | 48 | @Html.ActionLink("Delete", "Delete", new { id = product.Id }) 49 |
    53 | 54 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - Acme Product Management 7 | 8 | 9 | 10 | 11 |
    12 | 34 |
    35 |
    36 |
    37 | @RenderBody() 38 |
    39 |
    40 | 41 |
    42 |
    43 | © 2019 - APM.MVC - Privacy 44 |
    45 |
    46 | 47 | 48 | 49 | @RenderSection("Scripts", required: false) 50 | 51 | 52 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using APM.MVC 2 | @using APM.MVC.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/css/site.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 | /* Provide sufficient contrast against white background */ 11 | a { 12 | color: #0366d6; 13 | } 14 | 15 | .btn-primary { 16 | color: #fff; 17 | background-color: #1b6ec2; 18 | border-color: #1861ac; 19 | } 20 | 21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 22 | color: #fff; 23 | background-color: #1b6ec2; 24 | border-color: #1861ac; 25 | } 26 | 27 | /* Sticky footer styles 28 | -------------------------------------------------- */ 29 | html { 30 | font-size: 14px; 31 | } 32 | @media (min-width: 768px) { 33 | html { 34 | font-size: 16px; 35 | } 36 | } 37 | 38 | .border-top { 39 | border-top: 1px solid #e5e5e5; 40 | } 41 | .border-bottom { 42 | border-bottom: 1px solid #e5e5e5; 43 | } 44 | 45 | .box-shadow { 46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 47 | } 48 | 49 | button.accept-policy { 50 | font-size: 1rem; 51 | line-height: inherit; 52 | } 53 | 54 | /* Sticky footer styles 55 | -------------------------------------------------- */ 56 | html { 57 | position: relative; 58 | min-height: 100%; 59 | } 60 | 61 | body { 62 | /* Margin bottom by footer height */ 63 | margin-bottom: 60px; 64 | } 65 | .footer { 66 | position: absolute; 67 | bottom: 0; 68 | width: 100%; 69 | white-space: nowrap; 70 | line-height: 60px; /* Vertically center the text there */ 71 | } 72 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-WithUI/APM.MVC/wwwroot/favicon.ico -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/js/site.js: -------------------------------------------------------------------------------- 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 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2018 Twitter, Inc. 4 | Copyright (c) 2011-2018 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 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { 22 | display: block; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 28 | font-size: 1rem; 29 | font-weight: 400; 30 | line-height: 1.5; 31 | color: #212529; 32 | text-align: left; 33 | background-color: #fff; 34 | } 35 | 36 | [tabindex="-1"]:focus { 37 | outline: 0 !important; 38 | } 39 | 40 | hr { 41 | box-sizing: content-box; 42 | height: 0; 43 | overflow: visible; 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | margin-top: 0; 48 | margin-bottom: 0.5rem; 49 | } 50 | 51 | p { 52 | margin-top: 0; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | abbr[title], 57 | abbr[data-original-title] { 58 | text-decoration: underline; 59 | -webkit-text-decoration: underline dotted; 60 | text-decoration: underline dotted; 61 | cursor: help; 62 | border-bottom: 0; 63 | -webkit-text-decoration-skip-ink: none; 64 | text-decoration-skip-ink: none; 65 | } 66 | 67 | address { 68 | margin-bottom: 1rem; 69 | font-style: normal; 70 | line-height: inherit; 71 | } 72 | 73 | ol, 74 | ul, 75 | dl { 76 | margin-top: 0; 77 | margin-bottom: 1rem; 78 | } 79 | 80 | ol ol, 81 | ul ul, 82 | ol ul, 83 | ul ol { 84 | margin-bottom: 0; 85 | } 86 | 87 | dt { 88 | font-weight: 700; 89 | } 90 | 91 | dd { 92 | margin-bottom: .5rem; 93 | margin-left: 0; 94 | } 95 | 96 | blockquote { 97 | margin: 0 0 1rem; 98 | } 99 | 100 | b, 101 | strong { 102 | font-weight: bolder; 103 | } 104 | 105 | small { 106 | font-size: 80%; 107 | } 108 | 109 | sub, 110 | sup { 111 | position: relative; 112 | font-size: 75%; 113 | line-height: 0; 114 | vertical-align: baseline; 115 | } 116 | 117 | sub { 118 | bottom: -.25em; 119 | } 120 | 121 | sup { 122 | top: -.5em; 123 | } 124 | 125 | a { 126 | color: #007bff; 127 | text-decoration: none; 128 | background-color: transparent; 129 | } 130 | 131 | a:hover { 132 | color: #0056b3; 133 | text-decoration: underline; 134 | } 135 | 136 | a:not([href]):not([tabindex]) { 137 | color: inherit; 138 | text-decoration: none; 139 | } 140 | 141 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 142 | color: inherit; 143 | text-decoration: none; 144 | } 145 | 146 | a:not([href]):not([tabindex]):focus { 147 | outline: 0; 148 | } 149 | 150 | pre, 151 | code, 152 | kbd, 153 | samp { 154 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 155 | font-size: 1em; 156 | } 157 | 158 | pre { 159 | margin-top: 0; 160 | margin-bottom: 1rem; 161 | overflow: auto; 162 | } 163 | 164 | figure { 165 | margin: 0 0 1rem; 166 | } 167 | 168 | img { 169 | vertical-align: middle; 170 | border-style: none; 171 | } 172 | 173 | svg { 174 | overflow: hidden; 175 | vertical-align: middle; 176 | } 177 | 178 | table { 179 | border-collapse: collapse; 180 | } 181 | 182 | caption { 183 | padding-top: 0.75rem; 184 | padding-bottom: 0.75rem; 185 | color: #6c757d; 186 | text-align: left; 187 | caption-side: bottom; 188 | } 189 | 190 | th { 191 | text-align: inherit; 192 | } 193 | 194 | label { 195 | display: inline-block; 196 | margin-bottom: 0.5rem; 197 | } 198 | 199 | button { 200 | border-radius: 0; 201 | } 202 | 203 | button:focus { 204 | outline: 1px dotted; 205 | outline: 5px auto -webkit-focus-ring-color; 206 | } 207 | 208 | input, 209 | button, 210 | select, 211 | optgroup, 212 | textarea { 213 | margin: 0; 214 | font-family: inherit; 215 | font-size: inherit; 216 | line-height: inherit; 217 | } 218 | 219 | button, 220 | input { 221 | overflow: visible; 222 | } 223 | 224 | button, 225 | select { 226 | text-transform: none; 227 | } 228 | 229 | select { 230 | word-wrap: normal; 231 | } 232 | 233 | button, 234 | [type="button"], 235 | [type="reset"], 236 | [type="submit"] { 237 | -webkit-appearance: button; 238 | } 239 | 240 | button:not(:disabled), 241 | [type="button"]:not(:disabled), 242 | [type="reset"]:not(:disabled), 243 | [type="submit"]:not(:disabled) { 244 | cursor: pointer; 245 | } 246 | 247 | button::-moz-focus-inner, 248 | [type="button"]::-moz-focus-inner, 249 | [type="reset"]::-moz-focus-inner, 250 | [type="submit"]::-moz-focus-inner { 251 | padding: 0; 252 | border-style: none; 253 | } 254 | 255 | input[type="radio"], 256 | input[type="checkbox"] { 257 | box-sizing: border-box; 258 | padding: 0; 259 | } 260 | 261 | input[type="date"], 262 | input[type="time"], 263 | input[type="datetime-local"], 264 | input[type="month"] { 265 | -webkit-appearance: listbox; 266 | } 267 | 268 | textarea { 269 | overflow: auto; 270 | resize: vertical; 271 | } 272 | 273 | fieldset { 274 | min-width: 0; 275 | padding: 0; 276 | margin: 0; 277 | border: 0; 278 | } 279 | 280 | legend { 281 | display: block; 282 | width: 100%; 283 | max-width: 100%; 284 | padding: 0; 285 | margin-bottom: .5rem; 286 | font-size: 1.5rem; 287 | line-height: inherit; 288 | color: inherit; 289 | white-space: normal; 290 | } 291 | 292 | progress { 293 | vertical-align: baseline; 294 | } 295 | 296 | [type="number"]::-webkit-inner-spin-button, 297 | [type="number"]::-webkit-outer-spin-button { 298 | height: auto; 299 | } 300 | 301 | [type="search"] { 302 | outline-offset: -2px; 303 | -webkit-appearance: none; 304 | } 305 | 306 | [type="search"]::-webkit-search-decoration { 307 | -webkit-appearance: none; 308 | } 309 | 310 | ::-webkit-file-upload-button { 311 | font: inherit; 312 | -webkit-appearance: button; 313 | } 314 | 315 | output { 316 | display: inline-block; 317 | } 318 | 319 | summary { 320 | display: list-item; 321 | cursor: pointer; 322 | } 323 | 324 | template { 325 | display: none; 326 | } 327 | 328 | [hidden] { 329 | display: none !important; 330 | } 331 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/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}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}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:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[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}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | // Unobtrusive validation support library for jQuery and jQuery Validate 2 | // Copyright (c) .NET Foundation. All rights reserved. 3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 4 | // @version v3.2.11 5 | !function(a){"function"==typeof define&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery-validation")):jQuery.validator.unobtrusive=a(jQuery)}(function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a("
  • ").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function u(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=f.unobtrusive.options||{},u=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),u("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),u("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),u("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var m,f=a.validator,v="unobtrusiveValidation";return f.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=u(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){f.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=u(this);a&&a.attachValidation()})}},m=f.unobtrusive.adapters,m.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},m.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},m.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},m.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},f.addMethod("__dummy__",function(a,e,n){return!0}),f.addMethod("regex",function(a,e,n){var t;return!!this.optional(e)||(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),f.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),f.methods.extension?(m.addSingleVal("accept","mimtype"),m.addSingleVal("extension","extension")):m.addSingleVal("extension","extension","accept"),m.addSingleVal("regex","pattern"),m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),m.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),m.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),m.add("required",function(a){"INPUT"===a.element.tagName.toUpperCase()&&"CHECKBOX"===a.element.type.toUpperCase()||e(a,"required",!0)}),m.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),m.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),m.add("fileextensions",["extensions"],function(a){e(a,"extension",a.params.extensions)}),a(function(){f.unobtrusive.parse(document)}),f.unobtrusive}); -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/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 | -------------------------------------------------------------------------------- /APM-WithUI/APM.MVC/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright JS Foundation and other contributors, https://js.foundation/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /APM-WithUI/APM.SL.Test/APM.SL.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL.Test 6 | enable 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /APM-WithUI/APM.SL.Test/DiscountTest.cs: -------------------------------------------------------------------------------- 1 | using APM.Utilities; 2 | using System; 3 | using System.Collections.Generic; 4 | using Xunit; 5 | 6 | namespace APM.SL.Test 7 | { 8 | public class DiscountTest 9 | { 10 | // 11 | // FindDiscount 12 | // 13 | [Fact] 14 | public void FindDiscount_WhenListIsNull_ShouldReturnNull() 15 | { 16 | // Arrange 17 | List? discounts = null; 18 | var discountName = "40% off"; 19 | Discount? expected = null; 20 | var discount = new Discount(); 21 | 22 | // Act 23 | var actual = discount.FindDiscount(discounts, discountName); 24 | 25 | // Assert 26 | Assert.Equal(expected, actual); 27 | } 28 | 29 | [Fact] 30 | public void FindDiscountWithException_WhenListIsNull_ShouldThrow() 31 | { 32 | // Arrange 33 | List? discounts = null; 34 | var discountName = "40% off"; 35 | var discount = new Discount(); 36 | 37 | // Act & Assert 38 | var ex = Assert.Throws(() => discount.FindDiscountWithException(discounts, discountName)); 39 | Assert.Equal("No discounts found", ex.Message); 40 | } 41 | 42 | [Fact] 43 | public void FindDiscountWithException_WhenNotFound_ShouldReturnNotFound() 44 | { 45 | // Arrange 46 | List? discounts = new List(); 47 | var discountName = "40% off"; 48 | var discount = new Discount(); 49 | 50 | // Act & Assert 51 | var ex = Assert.Throws(() => discount.FindDiscountWithException(discounts, discountName)); 52 | Assert.Equal("Discount not found", ex.Message); 53 | } 54 | 55 | [Fact] 56 | public void FindDiscountWithTuple_WhenListIsNull_ShouldReturnNull() 57 | { 58 | // Arrange 59 | List? discounts = null; 60 | var discountName = "40% off"; 61 | (Discount? Discount, string? Message) expected = (Discount: null, Message: "No discounts found"); 62 | var discount = new Discount(); 63 | 64 | // Act 65 | var actual = discount.FindDiscountWithTuple(discounts, discountName); 66 | 67 | // Assert 68 | Assert.Equal(expected, actual); 69 | } 70 | 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /APM-WithUI/APM.SL.Test/ProductTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/CSharp-Defense/133c350698aa974a6e233f86d44cc49f810f9ab6/APM-WithUI/APM.SL.Test/ProductTest.cs -------------------------------------------------------------------------------- /APM-WithUI/APM.SL/APM.SL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | APM.SL 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /APM-WithUI/APM.SL/Discount.cs: -------------------------------------------------------------------------------- 1 | using APM.Utilities; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace APM.SL 6 | { 7 | public class Discount 8 | { 9 | public int DiscountId { get; private set; } 10 | public string DiscountName { get; set; } = ""; 11 | 12 | public decimal? PercentOff { get; set; } 13 | 14 | // ... Discount details 15 | 16 | public Discount? FindDiscount(List? discounts, string discountName) 17 | { 18 | if (discounts is null) return null; 19 | 20 | var foundDiscount = discounts.Find(d => d.DiscountName == discountName); 21 | 22 | return foundDiscount; 23 | } 24 | 25 | public Discount FindDiscountWithException(List? discounts, string discountName) 26 | { 27 | if (discounts is null) 28 | throw new ArgumentException("No discounts found"); 29 | 30 | var foundDiscount = discounts.Find(d => d.DiscountName == discountName); 31 | 32 | if (foundDiscount is null) 33 | throw new DiscountNotFoundException("Discount not found"); 34 | 35 | return foundDiscount; 36 | } 37 | 38 | public (Discount? Discount, string? Message) FindDiscountWithTuple(List? discounts, string discountName) 39 | { 40 | if (discounts is null) 41 | return (Discount: null, Message: "No discounts found"); 42 | 43 | var foundDiscount = 44 | discounts.Find(d => d.DiscountName == discountName); 45 | 46 | if (foundDiscount is null) 47 | return (Discount: null, Message: "Discount not found"); 48 | 49 | return (Discount: foundDiscount, Message: null); 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities.Test/APM.Utilities.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | enable 6 | 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities.Test/EmailTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace APM.SL.Test 5 | { 6 | public class EmailTest 7 | { 8 | [Fact] 9 | public void SendEmail_WhenValidValues_ShouldReturnTrue() 10 | { 11 | // Arrange 12 | var expected = true; 13 | 14 | // Act 15 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 16 | "Please confirm our 1PM meeting", 17 | DateTime.Now); 18 | 19 | // Assert 20 | Assert.Equal(expected, actual); 21 | } 22 | 23 | [Fact] 24 | public void SendEmail_WhenOptionalValues_ShouldReturnTrue() 25 | { 26 | // Arrange 27 | var expected = true; 28 | 29 | // Act 30 | bool actual = Utility.SendEmail("Jack Harkness", "Today's Meeting", 31 | "Please confirm our 1PM meeting", 32 | DateTime.Now, 33 | saveCopy: true, highPriority:true, 34 | includeSignature: false); 35 | 36 | // Assert 37 | Assert.Equal(expected, actual); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # IDE0063: Use simple 'using' statement 4 | csharp_prefer_simple_using_statement = false:suggestion 5 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/APM.Utilities.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/DiscountNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.Utilities 6 | { 7 | [Serializable()] 8 | public class DiscountNotFoundException : System.Exception 9 | { 10 | public DiscountNotFoundException() : base() { } 11 | 12 | public DiscountNotFoundException(string message) : base(message) { } 13 | 14 | public DiscountNotFoundException(string message, Exception inner) : base(message, inner) { } 15 | 16 | protected DiscountNotFoundException(System.Runtime.Serialization.SerializationInfo info, 17 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/Guard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Guard 8 | { 9 | public static void ThrowIfNullOrEmpty(string argumentValue, string message, string parameterName) 10 | { 11 | if (string.IsNullOrWhiteSpace(argumentValue)) throw new ValidationException(message, parameterName); 12 | } 13 | 14 | public static decimal ThrowIfNotPositiveDecimal(string argumentValue, string message, string parameterName) 15 | { 16 | var success = decimal.TryParse(argumentValue, out decimal result); 17 | if (!success || result < 0) throw new ArgumentException(message, parameterName); 18 | 19 | return result; 20 | } 21 | 22 | public static decimal ThrowIfNotPositiveNonZeroDecimal(string argumentValue, string message, string parameterName) 23 | { 24 | var success = decimal.TryParse(argumentValue, out decimal result); 25 | if (!success || result <= 0) throw new ArgumentException(message, parameterName); 26 | 27 | return result; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/OperationResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace APM.SL 6 | { 7 | public class OperationResult 8 | { 9 | public bool Success { get; set; } 10 | public string ValidationMessage { get; set; } 11 | 12 | public OperationResult() 13 | { 14 | ValidationMessage = ""; 15 | Success = false; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace APM.SL 6 | { 7 | public static class Utility 8 | { 9 | public static bool SendEmail(string recipient, string subject, 10 | string body, DateTime sendDate, 11 | bool saveCopy = false, bool highPriority = false, 12 | bool includeSignature = true) 13 | { 14 | // Send email 15 | Utility.LogToFile(new string[] { "Email sent:", recipient, subject, body, sendDate.ToShortDateString(), 16 | saveCopy.ToString(), highPriority.ToString(), includeSignature.ToString() }); 17 | 18 | return true; 19 | } 20 | 21 | public static void LogToFile(string[] textToLog) 22 | { 23 | string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 24 | 25 | if (String.IsNullOrEmpty(docPath)) throw new InvalidOperationException("Path cannot be null"); 26 | 27 | using (StreamWriter w = File.AppendText(Path.Combine(docPath, "log.txt"))) 28 | { 29 | w.WriteLine(""); 30 | w.Write("Log Entry: "); 31 | w.WriteLine($"{DateTime.Now.ToLongTimeString()}"); 32 | foreach (var logText in textToLog) 33 | w.WriteLine($" - {logText}"); 34 | w.WriteLine("-------------------------------"); 35 | } 36 | } 37 | 38 | public static string RemoveParenthetical(this String text) 39 | { 40 | return Regex.Replace(text, @"\(.*\)", ""); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Utilities/ValidationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace APM.SL 4 | { 5 | [Serializable()] 6 | public class ValidationException : System.ArgumentException 7 | { 8 | public ValidationException() : base() { } 9 | 10 | public ValidationException(string message) : base(message) { } 11 | 12 | public ValidationException(string message, string paramName) : base(message, paramName) { } 13 | 14 | public ValidationException(string message, Exception inner) : base(message, inner) { } 15 | 16 | protected ValidationException(System.Runtime.Serialization.SerializationInfo info, 17 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Win/APM.Win.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Win/PriceUpdate.cs: -------------------------------------------------------------------------------- 1 | using APM.SL; 2 | using System; 3 | using System.Diagnostics; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | namespace Win 8 | { 9 | public partial class PriceUpdate : Form 10 | { 11 | public PriceUpdate() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void Calculate_Click(object sender, EventArgs e) 17 | { 18 | var price = priceTextBox.Text; 19 | var cost = costTextBox.Text; 20 | 21 | // Calculate and check the profit margin 22 | var product = new Product(); 23 | 24 | decimal calculatedMargin = 0; 25 | ep.Clear(); 26 | try 27 | { 28 | calculatedMargin = product.CalculateMargin(cost, price); 29 | } 30 | catch (ValidationException ex) when (ex.ParamName == "cost") 31 | { 32 | ep.SetError(costTextBox, ex.Message); 33 | } 34 | catch (ValidationException ex) when (ex.ParamName == "price") 35 | { 36 | ep.SetError(priceTextBox, ex.Message); 37 | } 38 | 39 | var isAcceptable = calculatedMargin >= 40; 40 | 41 | if (isAcceptable) 42 | { 43 | marginLabel.ForeColor = Color.ForestGreen; 44 | } 45 | else 46 | { 47 | marginLabel.ForeColor = Color.Red; 48 | } 49 | 50 | // Display the results 51 | marginLabel.Text = calculatedMargin.ToString() + "%"; 52 | } 53 | 54 | //protected void costTextbox_Validating(object sender, System.ComponentModel.CancelEventArgs e) 55 | //{ 56 | // try 57 | // { 58 | // ep.SetError(costTextBox, ""); 59 | // } 60 | // catch (Exception ex) 61 | // { 62 | // ep.SetError(costTextBox, ex.Message); 63 | // } 64 | //} 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /APM-WithUI/APM.Win/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Win 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new PriceUpdate()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /APM-WithUI/APMWithUI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29326.143 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL", "APM.SL\APM.SL.csproj", "{7D10D82E-2BD9-4626-95F4-5979D5F0A66F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.SL.Test", "APM.SL.Test\APM.SL.Test.csproj", "{C332BD2C-D120-42F9-90D8-106AFAD4C1CE}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities", "APM.Utilities\APM.Utilities.csproj", "{1291C026-36DC-48A0-94C9-7C4C934E9C18}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Utilities.Test", "APM.Utilities.Test\APM.Utilities.Test.csproj", "{80F03195-553E-49F2-909F-05D50F26E59A}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.MVC", "APM.MVC\APM.MVC.csproj", "{DA04EDBA-AA99-4411-AD76-33868604835D}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APM.Win", "APM.Win\APM.Win.csproj", "{750528DE-BDD0-4390-905F-4E5999E1C994}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {7D10D82E-2BD9-4626-95F4-5979D5F0A66F}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {C332BD2C-D120-42F9-90D8-106AFAD4C1CE}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {1291C026-36DC-48A0-94C9-7C4C934E9C18}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {80F03195-553E-49F2-909F-05D50F26E59A}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {80F03195-553E-49F2-909F-05D50F26E59A}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {DA04EDBA-AA99-4411-AD76-33868604835D}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {750528DE-BDD0-4390-905F-4E5999E1C994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {750528DE-BDD0-4390-905F-4E5999E1C994}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {750528DE-BDD0-4390-905F-4E5999E1C994}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {750528DE-BDD0-4390-905F-4E5999E1C994}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {5330F312-3A35-4D4E-B981-96659E196D29} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Deborah Kurata 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSharp-Defense 2 | Materials for the Defensive Coding in C# Pluralsight Course 3 | 4 | `APM-Begin`: The .NET solution as of the start of the course. It contains several class library projects and their associated unit tests. It also has a prototype of an MVC user interface. You should be able to work with this code on Windows or on a Mac. 5 | 6 | `APM-Final`: The same solution, but with the code as of the end of the course. You should be able to work with this code on Windows or on a Mac. 7 | 8 | `APM-WithUI`: The final code with an additional Windows Forms project. This code only runs on Windows. 9 | --------------------------------------------------------------------------------