├── .gitattributes ├── .gitignore ├── FoodDelivery.Core ├── Extensions │ └── SeoExtensions.cs └── FoodDelivery.Core.csproj ├── FoodDelivery.Data ├── Entities │ ├── BaseEntity.cs │ ├── Foods │ │ ├── Food.cs │ │ ├── FoodType.cs │ │ └── ViewModels │ │ │ └── FoodListingViewModel.cs │ ├── Restaurants │ │ └── Restaurant.cs │ ├── Reviews │ │ └── Review.cs │ └── ShoppingCarts │ │ ├── Dto │ │ └── ShoppingCartDto.cs │ │ ├── ShoppingCart.cs │ │ ├── ShoppingCartItems.cs │ │ └── ViewModels │ │ ├── ShoppingCartItemViewModel.cs │ │ └── ShoppingCartViewModel.cs └── FoodDelivery.Data.csproj ├── FoodDelivery.Repository ├── ApplicationDbContext.cs ├── FoodDelivery.Repository.csproj ├── IRepository.cs └── Repository.cs ├── FoodDelivery.Service ├── FoodDelivery.Service.csproj └── Foods │ ├── FoodService.cs │ ├── FoodTypeService.cs │ ├── IFoodService.cs │ └── IFoodTypeService.cs ├── FoodDelivery.sln ├── FoodDelivery ├── Controllers │ ├── Api │ │ └── FoodsController.cs │ ├── BaseController.cs │ ├── FoodsController.cs │ ├── HomeController.cs │ └── ShoppingCartController.cs ├── FoodDelivery.csproj ├── Migrations │ ├── 20180930100703_InitialCreate.Designer.cs │ ├── 20180930100703_InitialCreate.cs │ ├── 20181007141328_AddFoodTypesData.Designer.cs │ ├── 20181007141328_AddFoodTypesData.cs │ ├── 20181110142416_ChangePriceColumnTypeInFoodTable.Designer.cs │ ├── 20181110142416_ChangePriceColumnTypeInFoodTable.cs │ ├── 20181120143745_AddedMoreFoods.Designer.cs │ ├── 20181120143745_AddedMoreFoods.cs │ └── ApplicationDbContextModelSnapshot.cs ├── Models │ └── ErrorViewModel.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── Startup.cs ├── TagHelpers │ └── FoodTypeSideBarTagHelper.cs ├── Views │ ├── Foods │ │ ├── Details.cshtml │ │ ├── FoodsByType.cshtml │ │ └── Index.cshtml │ ├── Home │ │ ├── About.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _CookieConsentPartial.cshtml │ │ ├── _Layout.cshtml │ │ └── _ValidationScriptsPartial.cshtml │ ├── ShoppingCart │ │ └── Index.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml ├── appsettings.Development.json ├── appsettings.json ├── bundleconfig.json ├── compilerconfig.json ├── compilerconfig.json.defaults ├── libman.json └── wwwroot │ ├── css │ ├── font-awesome.min.css │ ├── site.css │ ├── site.min.css │ └── site.scss │ ├── favicon.ico │ ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 │ ├── images │ ├── appetizer-bowl-breakfast-280018.jpg │ ├── appetizer-chicken-chicken-dippers-1059943.jpg │ ├── appetizer-close-up-cucumber-406152.jpg │ ├── asian-food-bowl-cuisine-699953.jpg │ ├── bakery-baking-blueberries-291528.jpg │ ├── banner1.svg │ ├── banner2.svg │ ├── banner3.svg │ ├── barbecue-bbq-cooking-111131.jpg │ ├── basil-close-up-cooking-725997.jpg │ ├── beef-bread-burger-156114.jpg │ ├── blur-breakfast-close-up-376464.jpg │ ├── bowl-cooking-cuisine-698549.jpg │ ├── bread-breakfast-bun-461382.jpg │ ├── breakfast-chocolate-cream-264727.jpg │ ├── burrito-chicken-close-up-461198.jpg │ ├── cheese-close-up-crust-1146760.jpg │ ├── chicken-chips-delicious-7782.jpg │ ├── chicken-close-up-crispy-60616.jpg │ ├── chicken-dinner-dish-236781.jpg │ ├── chopsticks-cuisine-dinner-46247.jpg │ ├── close-up-cooking-dinner-46239.jpg │ ├── cream-dessert-glass-8382.jpg │ └── egg-food-fried-rice-53121 (1).jpg │ ├── js │ ├── bootstrap-notify.min.js │ ├── site.js │ └── site.min.js │ └── lib │ ├── bootstrap │ ├── .bower.json │ ├── LICENSE │ └── dist │ │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ ├── jquery-validation-unobtrusive │ ├── .bower.json │ ├── LICENSE.txt │ ├── jquery.validate.unobtrusive.js │ └── jquery.validate.unobtrusive.min.js │ ├── jquery-validation │ ├── .bower.json │ ├── LICENSE.md │ └── dist │ │ ├── additional-methods.js │ │ ├── additional-methods.min.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js │ └── jquery │ ├── .bower.json │ ├── LICENSE.txt │ └── dist │ ├── jquery.js │ ├── jquery.min.js │ └── jquery.min.map ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /FoodDelivery.Core/Extensions/SeoExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | 6 | namespace FoodDelivery.Core.Extensions 7 | { 8 | public static class SeoExtensions 9 | { 10 | /// 11 | /// Creates a URL And SEO friendly slug 12 | /// 13 | /// Text to slugify 14 | /// Max length of slug 15 | /// URL and SEO friendly string 16 | public static string SeoFriendlyUrl(this string text, int maxLength = 0) 17 | { 18 | // Return empty value if text is null 19 | if (text == null) return ""; 20 | var normalizedString = text 21 | // Make lowercase 22 | .ToLowerInvariant() 23 | // Normalize the text 24 | .Normalize(NormalizationForm.FormD); 25 | var stringBuilder = new StringBuilder(); 26 | var stringLength = normalizedString.Length; 27 | var prevdash = false; 28 | var trueLength = 0; 29 | char c; 30 | for (int i = 0; i < stringLength; i++) 31 | { 32 | c = normalizedString[i]; 33 | switch (CharUnicodeInfo.GetUnicodeCategory(c)) 34 | { 35 | // Check if the character is a letter or a digit if the character is a 36 | // international character remap it to an ascii valid character 37 | case UnicodeCategory.LowercaseLetter: 38 | case UnicodeCategory.UppercaseLetter: 39 | case UnicodeCategory.DecimalDigitNumber: 40 | if (c < 128) 41 | stringBuilder.Append(c); 42 | else 43 | stringBuilder.Append(ConstHelper.RemapInternationalCharToAscii(c)); 44 | prevdash = false; 45 | trueLength = stringBuilder.Length; 46 | break; 47 | // Check if the character is to be replaced by a hyphen but only if the last character wasn't 48 | case UnicodeCategory.SpaceSeparator: 49 | case UnicodeCategory.ConnectorPunctuation: 50 | case UnicodeCategory.DashPunctuation: 51 | case UnicodeCategory.OtherPunctuation: 52 | case UnicodeCategory.MathSymbol: 53 | if (!prevdash) 54 | { 55 | stringBuilder.Append('-'); 56 | prevdash = true; 57 | trueLength = stringBuilder.Length; 58 | } 59 | break; 60 | } 61 | // If we are at max length, stop parsing 62 | if (maxLength > 0 && trueLength >= maxLength) 63 | break; 64 | } 65 | // Trim excess hyphens 66 | var result = stringBuilder.ToString().Trim('-'); 67 | // Remove any excess character to meet maxlength criteria 68 | return maxLength <= 0 || result.Length <= maxLength ? result : result.Substring(0, maxLength); 69 | } 70 | } 71 | 72 | public static class ConstHelper 73 | { 74 | /// 75 | /// Remaps international characters to ascii compatible ones 76 | /// based of: https://meta.stackexchange.com/questions/7435/non-us-ascii-characters-dropped-from-full-profile-url/7696#7696 77 | /// 78 | /// Charcter to remap 79 | /// Remapped character 80 | public static string RemapInternationalCharToAscii(char c) 81 | { 82 | string s = c.ToString().ToLowerInvariant(); 83 | if ("àåáâäãåą".Contains(s)) 84 | { 85 | return "a"; 86 | } 87 | else if ("èéêëę".Contains(s)) 88 | { 89 | return "e"; 90 | } 91 | else if ("ìíîïı".Contains(s)) 92 | { 93 | return "i"; 94 | } 95 | else if ("òóôõöøőð".Contains(s)) 96 | { 97 | return "o"; 98 | } 99 | else if ("ùúûüŭů".Contains(s)) 100 | { 101 | return "u"; 102 | } 103 | else if ("çćčĉ".Contains(s)) 104 | { 105 | return "c"; 106 | } 107 | else if ("żźž".Contains(s)) 108 | { 109 | return "z"; 110 | } 111 | else if ("śşšŝ".Contains(s)) 112 | { 113 | return "s"; 114 | } 115 | else if ("ñń".Contains(s)) 116 | { 117 | return "n"; 118 | } 119 | else if ("ýÿ".Contains(s)) 120 | { 121 | return "y"; 122 | } 123 | else if ("ğĝ".Contains(s)) 124 | { 125 | return "g"; 126 | } 127 | else if (c == 'ř') 128 | { 129 | return "r"; 130 | } 131 | else if (c == 'ł') 132 | { 133 | return "l"; 134 | } 135 | else if (c == 'đ') 136 | { 137 | return "d"; 138 | } 139 | else if (c == 'ß') 140 | { 141 | return "ss"; 142 | } 143 | else if (c == 'þ') 144 | { 145 | return "th"; 146 | } 147 | else if (c == 'ĥ') 148 | { 149 | return "h"; 150 | } 151 | else if (c == 'ĵ') 152 | { 153 | return "j"; 154 | } 155 | else 156 | { 157 | return ""; 158 | } 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /FoodDelivery.Core/FoodDelivery.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/BaseEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FoodDelivery.Data.Entities 6 | { 7 | public class BaseEntity 8 | { 9 | public long Id { get; set; } 10 | 11 | public DateTime CreatedDate { get; set; } 12 | 13 | public string CreatedBy { get; set; } 14 | 15 | public DateTime UpdatedDate { get; set; } 16 | 17 | public string UpdatedBy { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/Foods/Food.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities.Restaurants; 2 | using FoodDelivery.Data.Entities.Reviews; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | using System.Text; 8 | 9 | namespace FoodDelivery.Data.Entities.Foods 10 | { 11 | public class Food : BaseEntity 12 | { 13 | [MaxLength(150)] 14 | public string Name { get; set; } 15 | 16 | [MaxLength(250)] 17 | public string ShortDescription { get; set; } 18 | 19 | public string LongDescription { get; set; } 20 | 21 | [MaxLength(500)] 22 | public string ImageUrl { get; set; } 23 | 24 | public FoodType FoodType { get; set; } 25 | 26 | public Restaurant Restaurant { get; set; } 27 | 28 | [Column(TypeName = "decimal(18,2)")] 29 | public decimal Price { get; set; } 30 | 31 | public IList Reviews { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/Foods/FoodType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Text; 5 | 6 | namespace FoodDelivery.Data.Entities.Foods 7 | { 8 | public class FoodType : BaseEntity 9 | { 10 | [MaxLength(100)] 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/Foods/ViewModels/FoodListingViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FoodDelivery.Data.Entities.Foods.ViewModels 6 | { 7 | public class FoodListingViewModel 8 | { 9 | public long Id { get; set; } 10 | 11 | public string Name { get; set; } 12 | 13 | public string SeoFriendlyUrl { get; set; } 14 | 15 | public string ImageUrl { get; set; } 16 | 17 | public decimal Price { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/Restaurants/Restaurant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Text; 5 | 6 | namespace FoodDelivery.Data.Entities.Restaurants 7 | { 8 | public class Restaurant : BaseEntity 9 | { 10 | [MaxLength(250)] 11 | public string Name { get; set; } 12 | 13 | [MaxLength(500)] 14 | public string ImageUrl { get; set; } 15 | 16 | [MaxLength(500)] 17 | public string Address { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/Reviews/Review.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities.Foods; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Text; 6 | 7 | namespace FoodDelivery.Data.Entities.Reviews 8 | { 9 | public class Review : BaseEntity 10 | { 11 | public Food Food { get; set; } 12 | 13 | [Range(1, 5)] 14 | public int Rating { get; set; } 15 | 16 | [MaxLength(500)] 17 | public string Remark { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/ShoppingCarts/Dto/ShoppingCartDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FoodDelivery.Data.Entities.ShoppingCarts.Dto 6 | { 7 | public class ShoppingCartDto 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/ShoppingCarts/ShoppingCart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Text; 5 | 6 | namespace FoodDelivery.Data.Entities.ShoppingCarts 7 | { 8 | public class ShoppingCart : BaseEntity 9 | { 10 | public string UserId { get; set; } 11 | 12 | public DateTime DeliveryDateTime { get; set; } 13 | 14 | [MaxLength(250)] 15 | public string DeliveryAddress { get; set; } 16 | 17 | public decimal DeliveryFee { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/ShoppingCarts/ShoppingCartItems.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities.Foods; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Text; 6 | 7 | namespace FoodDelivery.Data.Entities.ShoppingCarts 8 | { 9 | public class ShoppingCartItems : BaseEntity 10 | { 11 | public ShoppingCart ShoppingCart { get; set; } 12 | 13 | public Food Food { get; set; } 14 | 15 | public decimal Price { get; set; } 16 | 17 | public int Quantity { get; set; } 18 | 19 | [MaxLength(500)] 20 | public string Remark { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/ShoppingCarts/ViewModels/ShoppingCartItemViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FoodDelivery.Data.Entities.ShoppingCarts.ViewModels 6 | { 7 | public class ShoppingCartItemViewModel 8 | { 9 | public long ShoppingCartItemId { get; set; } 10 | 11 | public string Name { get; set; } 12 | 13 | public int Quantity { get; set; } 14 | 15 | public decimal Price { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /FoodDelivery.Data/Entities/ShoppingCarts/ViewModels/ShoppingCartViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Text; 5 | 6 | namespace FoodDelivery.Data.Entities.ShoppingCarts.ViewModels 7 | { 8 | public class ShoppingCartViewModel 9 | { 10 | [MaxLength(250)] 11 | public string DeliveryAddress { get; set; } 12 | 13 | public IList Items { get; set; } = new List(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /FoodDelivery.Data/FoodDelivery.Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FoodDelivery.Repository/FoodDelivery.Repository.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore\2.1.1\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /FoodDelivery.Repository/IRepository.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FoodDelivery.Repository 9 | { 10 | public interface IRepository where T: BaseEntity 11 | { 12 | IQueryable GetAll(); 13 | 14 | Task GetAsync(long id); 15 | 16 | Task InsertAsync(T entity); 17 | 18 | Task InsertMultipleAsync(IList entities); 19 | 20 | Task UpdateAsync(T entity); 21 | 22 | Task UpdateMultipleAsync(IList entities); 23 | 24 | Task DeleteAsync(long id); 25 | 26 | Task DeleteMultipleAsync(IList entities); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /FoodDelivery.Repository/Repository.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace FoodDelivery.Repository 10 | { 11 | public class Repository : IRepository where T : BaseEntity 12 | { 13 | private ApplicationDbContext _dbContext; 14 | private DbSet entities; 15 | 16 | public Repository(ApplicationDbContext dbContext) 17 | { 18 | _dbContext = dbContext; 19 | entities = _dbContext.Set(); 20 | } 21 | 22 | public async Task DeleteAsync(long id) 23 | { 24 | var selectedEntity = await GetAsync(id); 25 | 26 | if (selectedEntity == null) 27 | { 28 | throw new ArgumentNullException("entity"); 29 | } 30 | 31 | entities.Remove(selectedEntity); 32 | await _dbContext.SaveChangesAsync(); 33 | } 34 | 35 | public async Task DeleteMultipleAsync(IList entities) 36 | { 37 | if (entities == null) 38 | { 39 | throw new ArgumentNullException("entities"); 40 | } 41 | 42 | foreach (var entity in entities) 43 | { 44 | entities.Remove(entity); 45 | } 46 | 47 | await _dbContext.SaveChangesAsync(); 48 | } 49 | 50 | public async Task GetAsync(long id) 51 | { 52 | return await _dbContext.Set().FirstOrDefaultAsync(q => q.Id == id); 53 | } 54 | 55 | public IQueryable GetAll() 56 | { 57 | return entities.AsQueryable(); 58 | } 59 | 60 | public async Task InsertAsync(T entity) 61 | { 62 | if (entity == null) 63 | { 64 | throw new ArgumentNullException("entity"); 65 | } 66 | 67 | await _dbContext.AddAsync(entity); 68 | await _dbContext.SaveChangesAsync(); 69 | } 70 | 71 | public async Task InsertMultipleAsync(IList entities) 72 | { 73 | if (entities == null) 74 | { 75 | throw new ArgumentNullException("entities"); 76 | } 77 | 78 | await _dbContext.AddRangeAsync(entities); 79 | await _dbContext.SaveChangesAsync(); 80 | } 81 | 82 | public async Task UpdateAsync(T entity) 83 | { 84 | if (entities == null) 85 | { 86 | throw new ArgumentNullException("entities"); 87 | } 88 | 89 | entity.UpdatedDate = DateTime.Now; 90 | 91 | await _dbContext.SaveChangesAsync(); 92 | } 93 | 94 | public async Task UpdateMultipleAsync(IList entities) 95 | { 96 | if (entities == null) 97 | { 98 | throw new ArgumentNullException("entities"); 99 | } 100 | 101 | foreach (var entity in entities) 102 | { 103 | entity.UpdatedDate = DateTime.Now; 104 | } 105 | 106 | await _dbContext.SaveChangesAsync(); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /FoodDelivery.Service/FoodDelivery.Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /FoodDelivery.Service/Foods/FoodService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using FoodDelivery.Core.Extensions; 6 | using FoodDelivery.Data.Entities.Foods; 7 | using FoodDelivery.Data.Entities.Foods.ViewModels; 8 | using FoodDelivery.Repository; 9 | using Microsoft.EntityFrameworkCore; 10 | 11 | namespace FoodDelivery.Service.Foods 12 | { 13 | public class FoodService : IFoodService 14 | { 15 | private readonly IRepository _repositoryFood; 16 | 17 | public FoodService ( 18 | IRepository repositoryFood 19 | ) 20 | { 21 | _repositoryFood = repositoryFood; 22 | } 23 | 24 | public async Task> GetAllFoodsAsync() 25 | { 26 | var foods = await _repositoryFood.GetAll().ToListAsync(); 27 | 28 | var foodListing = new List(); 29 | 30 | foreach(var food in foods) 31 | { 32 | foodListing.Add(new FoodListingViewModel 33 | { 34 | Id = food.Id, 35 | Name = food.Name, 36 | ImageUrl = food.ImageUrl, 37 | SeoFriendlyUrl = food.Name.SeoFriendlyUrl(), 38 | Price = food.Price 39 | }); 40 | } 41 | 42 | return foodListing; 43 | } 44 | 45 | public async Task> GetAllFoodsByFoodTypeIdAsync(long foodTypeId) 46 | { 47 | var foods = await _repositoryFood.GetAll() 48 | .Where(q => q.FoodType.Id == foodTypeId) 49 | .ToListAsync(); 50 | 51 | return foods; 52 | } 53 | 54 | public async Task GetFoodByIdAsync(long id) 55 | { 56 | var food = await _repositoryFood.GetAll() 57 | .FirstOrDefaultAsync(q => q.Id == id); 58 | 59 | return food; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /FoodDelivery.Service/Foods/FoodTypeService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using FoodDelivery.Data.Entities.Foods; 6 | using FoodDelivery.Repository; 7 | using Microsoft.EntityFrameworkCore; 8 | 9 | namespace FoodDelivery.Service.Foods 10 | { 11 | public class FoodTypeService : IFoodTypeService 12 | { 13 | private readonly IRepository _repositoryFoodType; 14 | 15 | public FoodTypeService( 16 | IRepository repositoryFoodType 17 | ) 18 | { 19 | _repositoryFoodType = repositoryFoodType; 20 | } 21 | 22 | public async Task> GetAvailableFoodTypesAsync() 23 | { 24 | var foodTypes = await _repositoryFoodType.GetAll().ToListAsync(); 25 | 26 | return foodTypes; 27 | } 28 | 29 | public async Task GetFoodTypeByIdAsync(long id) 30 | { 31 | var foodType = await _repositoryFoodType.GetAll().FirstOrDefaultAsync(q => q.Id == id); 32 | 33 | return foodType; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /FoodDelivery.Service/Foods/IFoodService.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities.Foods; 2 | using FoodDelivery.Data.Entities.Foods.ViewModels; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FoodDelivery.Service.Foods 9 | { 10 | public interface IFoodService 11 | { 12 | Task> GetAllFoodsAsync(); 13 | 14 | Task> GetAllFoodsByFoodTypeIdAsync(long foodTypeId); 15 | 16 | Task GetFoodByIdAsync(long id); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /FoodDelivery.Service/Foods/IFoodTypeService.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Data.Entities.Foods; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FoodDelivery.Service.Foods 8 | { 9 | public interface IFoodTypeService 10 | { 11 | Task> GetAvailableFoodTypesAsync(); 12 | 13 | Task GetFoodTypeByIdAsync(long id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /FoodDelivery.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2036 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodDelivery", "FoodDelivery\FoodDelivery.csproj", "{822A5758-D1E1-45D6-AA23-AEC98C77C102}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodDelivery.Service", "FoodDelivery.Service\FoodDelivery.Service.csproj", "{56ACDFB6-03CC-4880-8FF3-04B160A11B23}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodDelivery.Repository", "FoodDelivery.Repository\FoodDelivery.Repository.csproj", "{EB939D56-A7B5-4EA5-B32C-0C3DACFFF73D}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodDelivery.Data", "FoodDelivery.Data\FoodDelivery.Data.csproj", "{4B75931C-5786-43F6-8266-E58ABFD67188}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodDelivery.Core", "FoodDelivery.Core\FoodDelivery.Core.csproj", "{4C6439BD-FB44-462D-A2FA-25B59560AE9D}" 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 | {822A5758-D1E1-45D6-AA23-AEC98C77C102}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {822A5758-D1E1-45D6-AA23-AEC98C77C102}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {822A5758-D1E1-45D6-AA23-AEC98C77C102}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {822A5758-D1E1-45D6-AA23-AEC98C77C102}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {56ACDFB6-03CC-4880-8FF3-04B160A11B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {56ACDFB6-03CC-4880-8FF3-04B160A11B23}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {56ACDFB6-03CC-4880-8FF3-04B160A11B23}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {56ACDFB6-03CC-4880-8FF3-04B160A11B23}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {EB939D56-A7B5-4EA5-B32C-0C3DACFFF73D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {EB939D56-A7B5-4EA5-B32C-0C3DACFFF73D}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {EB939D56-A7B5-4EA5-B32C-0C3DACFFF73D}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {EB939D56-A7B5-4EA5-B32C-0C3DACFFF73D}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {4B75931C-5786-43F6-8266-E58ABFD67188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {4B75931C-5786-43F6-8266-E58ABFD67188}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {4B75931C-5786-43F6-8266-E58ABFD67188}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {4B75931C-5786-43F6-8266-E58ABFD67188}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {4C6439BD-FB44-462D-A2FA-25B59560AE9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {4C6439BD-FB44-462D-A2FA-25B59560AE9D}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {4C6439BD-FB44-462D-A2FA-25B59560AE9D}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {4C6439BD-FB44-462D-A2FA-25B59560AE9D}.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 = {1ED0BB5C-D972-426E-91E5-B101C0F7EA46} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /FoodDelivery/Controllers/Api/FoodsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using FoodDelivery.Service.Foods; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace FoodDelivery.Controllers.Api 9 | { 10 | [Route("api/[controller]/[action]")] 11 | public class FoodsController : Controller 12 | { 13 | private readonly IFoodService _foodService; 14 | private readonly IFoodTypeService _foodTypeService; 15 | 16 | public FoodsController( 17 | IFoodService foodService, 18 | IFoodTypeService foodTypeService 19 | ) 20 | { 21 | _foodService = foodService; 22 | _foodTypeService = foodTypeService; 23 | } 24 | 25 | public async Task AllFoods() 26 | { 27 | var foods = await _foodService.GetAllFoodsAsync(); 28 | 29 | return Json(new { isSuccess = true, data = foods }); 30 | } 31 | 32 | public async Task FoodsByType(long id) 33 | { 34 | var foods = await _foodService.GetAllFoodsByFoodTypeIdAsync(id); 35 | 36 | return Json(new { isSuccess = true, data = foods }); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /FoodDelivery/Controllers/BaseController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace FoodDelivery.Controllers 8 | { 9 | public abstract class BaseController : Controller 10 | { 11 | public BaseController() 12 | { 13 | 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /FoodDelivery/Controllers/FoodsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using FoodDelivery.Service.Foods; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace FoodDelivery.Controllers 9 | { 10 | public class FoodsController : BaseController 11 | { 12 | private readonly IFoodService _foodService; 13 | private readonly IFoodTypeService _foodTypeService; 14 | 15 | public FoodsController( 16 | IFoodService foodService, 17 | IFoodTypeService foodTypeService 18 | ) 19 | { 20 | _foodService = foodService; 21 | _foodTypeService = foodTypeService; 22 | } 23 | 24 | public async Task Index() 25 | { 26 | return View(); 27 | } 28 | 29 | [Route("foods/details/{id}/{name}")] 30 | public async Task Details(long id) 31 | { 32 | var food = await _foodService.GetFoodByIdAsync(id); 33 | 34 | return View(food); 35 | } 36 | 37 | [Route("foods/type/{id}/{name}")] 38 | public async Task FoodsByType(long id, string name) 39 | { 40 | var foods = await _foodService.GetAllFoodsByFoodTypeIdAsync(id); 41 | 42 | var foodType = await _foodTypeService.GetFoodTypeByIdAsync(id); 43 | ViewBag.FoodType = foodType?.Name ?? name; 44 | ViewBag.FoodTypeId = foodType.Id; 45 | 46 | return View(foods); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /FoodDelivery/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 FoodDelivery.Models; 8 | 9 | namespace FoodDelivery.Controllers 10 | { 11 | public class HomeController : BaseController 12 | { 13 | public IActionResult Index() 14 | { 15 | return Redirect("/Foods"); 16 | } 17 | 18 | public IActionResult About() 19 | { 20 | return View(); 21 | } 22 | 23 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 24 | public IActionResult Error() 25 | { 26 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /FoodDelivery/Controllers/ShoppingCartController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace FoodDelivery.Controllers 8 | { 9 | public class ShoppingCartController : BaseController 10 | { 11 | public IActionResult Index() 12 | { 13 | return View(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /FoodDelivery/FoodDelivery.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | $(IncludeRazorContentInPack) 32 | 33 | 34 | $(IncludeRazorContentInPack) 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20180930100703_InitialCreate.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using FoodDelivery.Repository; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace FoodDelivery.Migrations 11 | { 12 | [DbContext(typeof(ApplicationDbContext))] 13 | [Migration("20180930100703_InitialCreate")] 14 | partial class InitialCreate 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "2.1.3-rtm-32065") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 23 | 24 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 29 | 30 | b.Property("CreatedBy"); 31 | 32 | b.Property("CreatedDate"); 33 | 34 | b.Property("FoodTypeId"); 35 | 36 | b.Property("ImageUrl") 37 | .HasMaxLength(500); 38 | 39 | b.Property("LongDescription"); 40 | 41 | b.Property("Name") 42 | .HasMaxLength(150); 43 | 44 | b.Property("Price"); 45 | 46 | b.Property("RestaurantId"); 47 | 48 | b.Property("ShortDescription") 49 | .HasMaxLength(250); 50 | 51 | b.Property("UpdatedBy"); 52 | 53 | b.Property("UpdatedDate"); 54 | 55 | b.HasKey("Id"); 56 | 57 | b.HasIndex("FoodTypeId"); 58 | 59 | b.HasIndex("RestaurantId"); 60 | 61 | b.ToTable("Foods"); 62 | }); 63 | 64 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.FoodType", b => 65 | { 66 | b.Property("Id") 67 | .ValueGeneratedOnAdd() 68 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 69 | 70 | b.Property("CreatedBy"); 71 | 72 | b.Property("CreatedDate"); 73 | 74 | b.Property("Name") 75 | .HasMaxLength(100); 76 | 77 | b.Property("UpdatedBy"); 78 | 79 | b.Property("UpdatedDate"); 80 | 81 | b.HasKey("Id"); 82 | 83 | b.ToTable("FoodTypes"); 84 | }); 85 | 86 | modelBuilder.Entity("FoodDelivery.Data.Entities.Restaurants.Restaurant", b => 87 | { 88 | b.Property("Id") 89 | .ValueGeneratedOnAdd() 90 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 91 | 92 | b.Property("Address") 93 | .HasMaxLength(500); 94 | 95 | b.Property("CreatedBy"); 96 | 97 | b.Property("CreatedDate"); 98 | 99 | b.Property("ImageUrl") 100 | .HasMaxLength(500); 101 | 102 | b.Property("Name") 103 | .HasMaxLength(250); 104 | 105 | b.Property("UpdatedBy"); 106 | 107 | b.Property("UpdatedDate"); 108 | 109 | b.HasKey("Id"); 110 | 111 | b.ToTable("Restaurants"); 112 | }); 113 | 114 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 115 | { 116 | b.Property("Id") 117 | .ValueGeneratedOnAdd() 118 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 119 | 120 | b.Property("CreatedBy"); 121 | 122 | b.Property("CreatedDate"); 123 | 124 | b.Property("FoodId"); 125 | 126 | b.Property("Rating"); 127 | 128 | b.Property("Remark") 129 | .HasMaxLength(500); 130 | 131 | b.Property("UpdatedBy"); 132 | 133 | b.Property("UpdatedDate"); 134 | 135 | b.HasKey("Id"); 136 | 137 | b.HasIndex("FoodId"); 138 | 139 | b.ToTable("Reviews"); 140 | }); 141 | 142 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 143 | { 144 | b.HasOne("FoodDelivery.Data.Entities.Foods.FoodType", "FoodType") 145 | .WithMany() 146 | .HasForeignKey("FoodTypeId"); 147 | 148 | b.HasOne("FoodDelivery.Data.Entities.Restaurants.Restaurant", "Restaurant") 149 | .WithMany() 150 | .HasForeignKey("RestaurantId"); 151 | }); 152 | 153 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 154 | { 155 | b.HasOne("FoodDelivery.Data.Entities.Foods.Food", "Food") 156 | .WithMany("Reviews") 157 | .HasForeignKey("FoodId"); 158 | }); 159 | #pragma warning restore 612, 618 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20180930100703_InitialCreate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Metadata; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | namespace FoodDelivery.Migrations 6 | { 7 | public partial class InitialCreate : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.CreateTable( 12 | name: "FoodTypes", 13 | columns: table => new 14 | { 15 | Id = table.Column(nullable: false) 16 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 17 | CreatedDate = table.Column(nullable: false), 18 | CreatedBy = table.Column(nullable: true), 19 | UpdatedDate = table.Column(nullable: false), 20 | UpdatedBy = table.Column(nullable: true), 21 | Name = table.Column(maxLength: 100, nullable: true) 22 | }, 23 | constraints: table => 24 | { 25 | table.PrimaryKey("PK_FoodTypes", x => x.Id); 26 | }); 27 | 28 | migrationBuilder.CreateTable( 29 | name: "Restaurants", 30 | columns: table => new 31 | { 32 | Id = table.Column(nullable: false) 33 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 34 | CreatedDate = table.Column(nullable: false), 35 | CreatedBy = table.Column(nullable: true), 36 | UpdatedDate = table.Column(nullable: false), 37 | UpdatedBy = table.Column(nullable: true), 38 | Name = table.Column(maxLength: 250, nullable: true), 39 | ImageUrl = table.Column(maxLength: 500, nullable: true), 40 | Address = table.Column(maxLength: 500, nullable: true) 41 | }, 42 | constraints: table => 43 | { 44 | table.PrimaryKey("PK_Restaurants", x => x.Id); 45 | }); 46 | 47 | migrationBuilder.CreateTable( 48 | name: "Foods", 49 | columns: table => new 50 | { 51 | Id = table.Column(nullable: false) 52 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 53 | CreatedDate = table.Column(nullable: false), 54 | CreatedBy = table.Column(nullable: true), 55 | UpdatedDate = table.Column(nullable: false), 56 | UpdatedBy = table.Column(nullable: true), 57 | Name = table.Column(maxLength: 150, nullable: true), 58 | ShortDescription = table.Column(maxLength: 250, nullable: true), 59 | LongDescription = table.Column(nullable: true), 60 | ImageUrl = table.Column(maxLength: 500, nullable: true), 61 | FoodTypeId = table.Column(nullable: true), 62 | RestaurantId = table.Column(nullable: true), 63 | Price = table.Column(nullable: false) 64 | }, 65 | constraints: table => 66 | { 67 | table.PrimaryKey("PK_Foods", x => x.Id); 68 | table.ForeignKey( 69 | name: "FK_Foods_FoodTypes_FoodTypeId", 70 | column: x => x.FoodTypeId, 71 | principalTable: "FoodTypes", 72 | principalColumn: "Id", 73 | onDelete: ReferentialAction.Restrict); 74 | table.ForeignKey( 75 | name: "FK_Foods_Restaurants_RestaurantId", 76 | column: x => x.RestaurantId, 77 | principalTable: "Restaurants", 78 | principalColumn: "Id", 79 | onDelete: ReferentialAction.Restrict); 80 | }); 81 | 82 | migrationBuilder.CreateTable( 83 | name: "Reviews", 84 | columns: table => new 85 | { 86 | Id = table.Column(nullable: false) 87 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 88 | CreatedDate = table.Column(nullable: false), 89 | CreatedBy = table.Column(nullable: true), 90 | UpdatedDate = table.Column(nullable: false), 91 | UpdatedBy = table.Column(nullable: true), 92 | FoodId = table.Column(nullable: true), 93 | Rating = table.Column(nullable: false), 94 | Remark = table.Column(maxLength: 500, nullable: true) 95 | }, 96 | constraints: table => 97 | { 98 | table.PrimaryKey("PK_Reviews", x => x.Id); 99 | table.ForeignKey( 100 | name: "FK_Reviews_Foods_FoodId", 101 | column: x => x.FoodId, 102 | principalTable: "Foods", 103 | principalColumn: "Id", 104 | onDelete: ReferentialAction.Restrict); 105 | }); 106 | 107 | migrationBuilder.CreateIndex( 108 | name: "IX_Foods_FoodTypeId", 109 | table: "Foods", 110 | column: "FoodTypeId"); 111 | 112 | migrationBuilder.CreateIndex( 113 | name: "IX_Foods_RestaurantId", 114 | table: "Foods", 115 | column: "RestaurantId"); 116 | 117 | migrationBuilder.CreateIndex( 118 | name: "IX_Reviews_FoodId", 119 | table: "Reviews", 120 | column: "FoodId"); 121 | } 122 | 123 | protected override void Down(MigrationBuilder migrationBuilder) 124 | { 125 | migrationBuilder.DropTable( 126 | name: "Reviews"); 127 | 128 | migrationBuilder.DropTable( 129 | name: "Foods"); 130 | 131 | migrationBuilder.DropTable( 132 | name: "FoodTypes"); 133 | 134 | migrationBuilder.DropTable( 135 | name: "Restaurants"); 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20181007141328_AddFoodTypesData.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using FoodDelivery.Repository; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace FoodDelivery.Migrations 11 | { 12 | [DbContext(typeof(ApplicationDbContext))] 13 | [Migration("20181007141328_AddFoodTypesData")] 14 | partial class AddFoodTypesData 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "2.1.3-rtm-32065") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 23 | 24 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 29 | 30 | b.Property("CreatedBy"); 31 | 32 | b.Property("CreatedDate"); 33 | 34 | b.Property("FoodTypeId"); 35 | 36 | b.Property("ImageUrl") 37 | .HasMaxLength(500); 38 | 39 | b.Property("LongDescription"); 40 | 41 | b.Property("Name") 42 | .HasMaxLength(150); 43 | 44 | b.Property("Price"); 45 | 46 | b.Property("RestaurantId"); 47 | 48 | b.Property("ShortDescription") 49 | .HasMaxLength(250); 50 | 51 | b.Property("UpdatedBy"); 52 | 53 | b.Property("UpdatedDate"); 54 | 55 | b.HasKey("Id"); 56 | 57 | b.HasIndex("FoodTypeId"); 58 | 59 | b.HasIndex("RestaurantId"); 60 | 61 | b.ToTable("Foods"); 62 | }); 63 | 64 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.FoodType", b => 65 | { 66 | b.Property("Id") 67 | .ValueGeneratedOnAdd() 68 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 69 | 70 | b.Property("CreatedBy"); 71 | 72 | b.Property("CreatedDate"); 73 | 74 | b.Property("Name") 75 | .HasMaxLength(100); 76 | 77 | b.Property("UpdatedBy"); 78 | 79 | b.Property("UpdatedDate"); 80 | 81 | b.HasKey("Id"); 82 | 83 | b.ToTable("FoodTypes"); 84 | 85 | b.HasData( 86 | new { Id = 1L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 136, DateTimeKind.Local), Name = "Asian Foods", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 87 | new { Id = 2L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), Name = "Burgers", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 88 | new { Id = 3L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), Name = "Appetizers", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 89 | new { Id = 4L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), Name = "Desserts", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 90 | new { Id = 5L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), Name = "Breakfast", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 91 | new { Id = 6L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), Name = "Pizzas", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) } 92 | ); 93 | }); 94 | 95 | modelBuilder.Entity("FoodDelivery.Data.Entities.Restaurants.Restaurant", b => 96 | { 97 | b.Property("Id") 98 | .ValueGeneratedOnAdd() 99 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 100 | 101 | b.Property("Address") 102 | .HasMaxLength(500); 103 | 104 | b.Property("CreatedBy"); 105 | 106 | b.Property("CreatedDate"); 107 | 108 | b.Property("ImageUrl") 109 | .HasMaxLength(500); 110 | 111 | b.Property("Name") 112 | .HasMaxLength(250); 113 | 114 | b.Property("UpdatedBy"); 115 | 116 | b.Property("UpdatedDate"); 117 | 118 | b.HasKey("Id"); 119 | 120 | b.ToTable("Restaurants"); 121 | }); 122 | 123 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 124 | { 125 | b.Property("Id") 126 | .ValueGeneratedOnAdd() 127 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 128 | 129 | b.Property("CreatedBy"); 130 | 131 | b.Property("CreatedDate"); 132 | 133 | b.Property("FoodId"); 134 | 135 | b.Property("Rating"); 136 | 137 | b.Property("Remark") 138 | .HasMaxLength(500); 139 | 140 | b.Property("UpdatedBy"); 141 | 142 | b.Property("UpdatedDate"); 143 | 144 | b.HasKey("Id"); 145 | 146 | b.HasIndex("FoodId"); 147 | 148 | b.ToTable("Reviews"); 149 | }); 150 | 151 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 152 | { 153 | b.HasOne("FoodDelivery.Data.Entities.Foods.FoodType", "FoodType") 154 | .WithMany() 155 | .HasForeignKey("FoodTypeId"); 156 | 157 | b.HasOne("FoodDelivery.Data.Entities.Restaurants.Restaurant", "Restaurant") 158 | .WithMany() 159 | .HasForeignKey("RestaurantId"); 160 | }); 161 | 162 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 163 | { 164 | b.HasOne("FoodDelivery.Data.Entities.Foods.Food", "Food") 165 | .WithMany("Reviews") 166 | .HasForeignKey("FoodId"); 167 | }); 168 | #pragma warning restore 612, 618 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20181007141328_AddFoodTypesData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace FoodDelivery.Migrations 5 | { 6 | public partial class AddFoodTypesData : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.InsertData( 11 | table: "FoodTypes", 12 | columns: new[] { "Id", "CreatedBy", "CreatedDate", "Name", "UpdatedBy", "UpdatedDate" }, 13 | values: new object[,] 14 | { 15 | { 1L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 136, DateTimeKind.Local), "Asian Foods", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 16 | { 2L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), "Burgers", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 17 | { 3L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), "Appetizers", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 18 | { 4L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), "Desserts", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 19 | { 5L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), "Breakfast", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }, 20 | { 6L, "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), "Pizzas", "seed", new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) } 21 | }); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DeleteData( 27 | table: "FoodTypes", 28 | keyColumn: "Id", 29 | keyValue: 1L); 30 | 31 | migrationBuilder.DeleteData( 32 | table: "FoodTypes", 33 | keyColumn: "Id", 34 | keyValue: 2L); 35 | 36 | migrationBuilder.DeleteData( 37 | table: "FoodTypes", 38 | keyColumn: "Id", 39 | keyValue: 3L); 40 | 41 | migrationBuilder.DeleteData( 42 | table: "FoodTypes", 43 | keyColumn: "Id", 44 | keyValue: 4L); 45 | 46 | migrationBuilder.DeleteData( 47 | table: "FoodTypes", 48 | keyColumn: "Id", 49 | keyValue: 5L); 50 | 51 | migrationBuilder.DeleteData( 52 | table: "FoodTypes", 53 | keyColumn: "Id", 54 | keyValue: 6L); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20181110142416_ChangePriceColumnTypeInFoodTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using FoodDelivery.Repository; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace FoodDelivery.Migrations 11 | { 12 | [DbContext(typeof(ApplicationDbContext))] 13 | [Migration("20181110142416_ChangePriceColumnTypeInFoodTable")] 14 | partial class ChangePriceColumnTypeInFoodTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "2.1.3-rtm-32065") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 23 | 24 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 29 | 30 | b.Property("CreatedBy"); 31 | 32 | b.Property("CreatedDate"); 33 | 34 | b.Property("FoodTypeId"); 35 | 36 | b.Property("ImageUrl") 37 | .HasMaxLength(500); 38 | 39 | b.Property("LongDescription"); 40 | 41 | b.Property("Name") 42 | .HasMaxLength(150); 43 | 44 | b.Property("Price") 45 | .HasColumnType("decimal(18,2)"); 46 | 47 | b.Property("RestaurantId"); 48 | 49 | b.Property("ShortDescription") 50 | .HasMaxLength(250); 51 | 52 | b.Property("UpdatedBy"); 53 | 54 | b.Property("UpdatedDate"); 55 | 56 | b.HasKey("Id"); 57 | 58 | b.HasIndex("FoodTypeId"); 59 | 60 | b.HasIndex("RestaurantId"); 61 | 62 | b.ToTable("Foods"); 63 | 64 | b.HasData( 65 | new { Id = 1L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), FoodTypeId = 1L, ImageUrl = "egg-food-fried-rice-53121 (1).jpg", Name = "Kimchi Fried Rice With Egg", Price = 7.00m, RestaurantId = 1L, ShortDescription = "Spicy fragnance kimchi fried rice together with an egg good enough for a simple meal!", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) } 66 | ); 67 | }); 68 | 69 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.FoodType", b => 70 | { 71 | b.Property("Id") 72 | .ValueGeneratedOnAdd() 73 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 74 | 75 | b.Property("CreatedBy"); 76 | 77 | b.Property("CreatedDate"); 78 | 79 | b.Property("Name") 80 | .HasMaxLength(100); 81 | 82 | b.Property("UpdatedBy"); 83 | 84 | b.Property("UpdatedDate"); 85 | 86 | b.HasKey("Id"); 87 | 88 | b.ToTable("FoodTypes"); 89 | 90 | b.HasData( 91 | new { Id = 1L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 102, DateTimeKind.Local), Name = "Asian Foods", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }, 92 | new { Id = 2L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), Name = "Burgers", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }, 93 | new { Id = 3L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), Name = "Appetizers", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }, 94 | new { Id = 4L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), Name = "Desserts", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }, 95 | new { Id = 5L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), Name = "Breakfast", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }, 96 | new { Id = 6L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), Name = "Pizzas", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) } 97 | ); 98 | }); 99 | 100 | modelBuilder.Entity("FoodDelivery.Data.Entities.Restaurants.Restaurant", b => 101 | { 102 | b.Property("Id") 103 | .ValueGeneratedOnAdd() 104 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 105 | 106 | b.Property("Address") 107 | .HasMaxLength(500); 108 | 109 | b.Property("CreatedBy"); 110 | 111 | b.Property("CreatedDate"); 112 | 113 | b.Property("ImageUrl") 114 | .HasMaxLength(500); 115 | 116 | b.Property("Name") 117 | .HasMaxLength(250); 118 | 119 | b.Property("UpdatedBy"); 120 | 121 | b.Property("UpdatedDate"); 122 | 123 | b.HasKey("Id"); 124 | 125 | b.ToTable("Restaurants"); 126 | 127 | b.HasData( 128 | new { Id = 1L, CreatedBy = "seed", CreatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), Name = "Authentic Korean Food Restaurant", UpdatedBy = "seed", UpdatedDate = new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) } 129 | ); 130 | }); 131 | 132 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 133 | { 134 | b.Property("Id") 135 | .ValueGeneratedOnAdd() 136 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 137 | 138 | b.Property("CreatedBy"); 139 | 140 | b.Property("CreatedDate"); 141 | 142 | b.Property("FoodId"); 143 | 144 | b.Property("Rating"); 145 | 146 | b.Property("Remark") 147 | .HasMaxLength(500); 148 | 149 | b.Property("UpdatedBy"); 150 | 151 | b.Property("UpdatedDate"); 152 | 153 | b.HasKey("Id"); 154 | 155 | b.HasIndex("FoodId"); 156 | 157 | b.ToTable("Reviews"); 158 | }); 159 | 160 | modelBuilder.Entity("FoodDelivery.Data.Entities.Foods.Food", b => 161 | { 162 | b.HasOne("FoodDelivery.Data.Entities.Foods.FoodType", "FoodType") 163 | .WithMany() 164 | .HasForeignKey("FoodTypeId"); 165 | 166 | b.HasOne("FoodDelivery.Data.Entities.Restaurants.Restaurant", "Restaurant") 167 | .WithMany() 168 | .HasForeignKey("RestaurantId"); 169 | }); 170 | 171 | modelBuilder.Entity("FoodDelivery.Data.Entities.Reviews.Review", b => 172 | { 173 | b.HasOne("FoodDelivery.Data.Entities.Foods.Food", "Food") 174 | .WithMany("Reviews") 175 | .HasForeignKey("FoodId"); 176 | }); 177 | #pragma warning restore 612, 618 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20181110142416_ChangePriceColumnTypeInFoodTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace FoodDelivery.Migrations 5 | { 6 | public partial class ChangePriceColumnTypeInFoodTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.AlterColumn( 11 | name: "Price", 12 | table: "Foods", 13 | type: "decimal(18,2)", 14 | nullable: false, 15 | oldClrType: typeof(decimal)); 16 | 17 | migrationBuilder.UpdateData( 18 | table: "FoodTypes", 19 | keyColumn: "Id", 20 | keyValue: 1L, 21 | columns: new[] { "CreatedDate", "UpdatedDate" }, 22 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 102, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 23 | 24 | migrationBuilder.UpdateData( 25 | table: "FoodTypes", 26 | keyColumn: "Id", 27 | keyValue: 2L, 28 | columns: new[] { "CreatedDate", "UpdatedDate" }, 29 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 30 | 31 | migrationBuilder.UpdateData( 32 | table: "FoodTypes", 33 | keyColumn: "Id", 34 | keyValue: 3L, 35 | columns: new[] { "CreatedDate", "UpdatedDate" }, 36 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 37 | 38 | migrationBuilder.UpdateData( 39 | table: "FoodTypes", 40 | keyColumn: "Id", 41 | keyValue: 4L, 42 | columns: new[] { "CreatedDate", "UpdatedDate" }, 43 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 44 | 45 | migrationBuilder.UpdateData( 46 | table: "FoodTypes", 47 | keyColumn: "Id", 48 | keyValue: 5L, 49 | columns: new[] { "CreatedDate", "UpdatedDate" }, 50 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 51 | 52 | migrationBuilder.UpdateData( 53 | table: "FoodTypes", 54 | keyColumn: "Id", 55 | keyValue: 6L, 56 | columns: new[] { "CreatedDate", "UpdatedDate" }, 57 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 58 | 59 | migrationBuilder.InsertData( 60 | table: "Restaurants", 61 | columns: new[] { "Id", "Address", "CreatedBy", "CreatedDate", "ImageUrl", "Name", "UpdatedBy", "UpdatedDate" }, 62 | values: new object[] { 1L, null, "seed", new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), null, "Authentic Korean Food Restaurant", "seed", new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) }); 63 | 64 | migrationBuilder.InsertData( 65 | table: "Foods", 66 | columns: new[] { "Id", "CreatedBy", "CreatedDate", "FoodTypeId", "ImageUrl", "LongDescription", "Name", "Price", "RestaurantId", "ShortDescription", "UpdatedBy", "UpdatedDate" }, 67 | values: new object[] { 1L, "seed", new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), 1L, "egg-food-fried-rice-53121 (1).jpg", null, "Kimchi Fried Rice With Egg", 7.00m, 1L, "Spicy fragnance kimchi fried rice together with an egg good enough for a simple meal!", "seed", new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) }); 68 | } 69 | 70 | protected override void Down(MigrationBuilder migrationBuilder) 71 | { 72 | migrationBuilder.DeleteData( 73 | table: "Foods", 74 | keyColumn: "Id", 75 | keyValue: 1L); 76 | 77 | migrationBuilder.DeleteData( 78 | table: "Restaurants", 79 | keyColumn: "Id", 80 | keyValue: 1L); 81 | 82 | migrationBuilder.AlterColumn( 83 | name: "Price", 84 | table: "Foods", 85 | nullable: false, 86 | oldClrType: typeof(decimal), 87 | oldType: "decimal(18,2)"); 88 | 89 | migrationBuilder.UpdateData( 90 | table: "FoodTypes", 91 | keyColumn: "Id", 92 | keyValue: 1L, 93 | columns: new[] { "CreatedDate", "UpdatedDate" }, 94 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 136, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 95 | 96 | migrationBuilder.UpdateData( 97 | table: "FoodTypes", 98 | keyColumn: "Id", 99 | keyValue: 2L, 100 | columns: new[] { "CreatedDate", "UpdatedDate" }, 101 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 102 | 103 | migrationBuilder.UpdateData( 104 | table: "FoodTypes", 105 | keyColumn: "Id", 106 | keyValue: 3L, 107 | columns: new[] { "CreatedDate", "UpdatedDate" }, 108 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 109 | 110 | migrationBuilder.UpdateData( 111 | table: "FoodTypes", 112 | keyColumn: "Id", 113 | keyValue: 4L, 114 | columns: new[] { "CreatedDate", "UpdatedDate" }, 115 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 116 | 117 | migrationBuilder.UpdateData( 118 | table: "FoodTypes", 119 | keyColumn: "Id", 120 | keyValue: 5L, 121 | columns: new[] { "CreatedDate", "UpdatedDate" }, 122 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 123 | 124 | migrationBuilder.UpdateData( 125 | table: "FoodTypes", 126 | keyColumn: "Id", 127 | keyValue: 6L, 128 | columns: new[] { "CreatedDate", "UpdatedDate" }, 129 | values: new object[] { new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local), new DateTime(2018, 10, 7, 22, 13, 28, 137, DateTimeKind.Local) }); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /FoodDelivery/Migrations/20181120143745_AddedMoreFoods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace FoodDelivery.Migrations 5 | { 6 | public partial class AddedMoreFoods : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.UpdateData( 11 | table: "FoodTypes", 12 | keyColumn: "Id", 13 | keyValue: 1L, 14 | columns: new[] { "CreatedDate", "UpdatedDate" }, 15 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 574, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 16 | 17 | migrationBuilder.UpdateData( 18 | table: "FoodTypes", 19 | keyColumn: "Id", 20 | keyValue: 2L, 21 | columns: new[] { "CreatedDate", "UpdatedDate" }, 22 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 23 | 24 | migrationBuilder.UpdateData( 25 | table: "FoodTypes", 26 | keyColumn: "Id", 27 | keyValue: 3L, 28 | columns: new[] { "CreatedDate", "UpdatedDate" }, 29 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 30 | 31 | migrationBuilder.UpdateData( 32 | table: "FoodTypes", 33 | keyColumn: "Id", 34 | keyValue: 4L, 35 | columns: new[] { "CreatedDate", "UpdatedDate" }, 36 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 37 | 38 | migrationBuilder.UpdateData( 39 | table: "FoodTypes", 40 | keyColumn: "Id", 41 | keyValue: 5L, 42 | columns: new[] { "CreatedDate", "UpdatedDate" }, 43 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 44 | 45 | migrationBuilder.UpdateData( 46 | table: "FoodTypes", 47 | keyColumn: "Id", 48 | keyValue: 6L, 49 | columns: new[] { "CreatedDate", "UpdatedDate" }, 50 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 51 | 52 | migrationBuilder.InsertData( 53 | table: "FoodTypes", 54 | columns: new[] { "Id", "CreatedBy", "CreatedDate", "Name", "UpdatedBy", "UpdatedDate" }, 55 | values: new object[] { 7L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local), "Roast", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 576, DateTimeKind.Local) }); 56 | 57 | migrationBuilder.UpdateData( 58 | table: "Foods", 59 | keyColumn: "Id", 60 | keyValue: 1L, 61 | columns: new[] { "CreatedDate", "UpdatedDate" }, 62 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }); 63 | 64 | migrationBuilder.InsertData( 65 | table: "Foods", 66 | columns: new[] { "Id", "CreatedBy", "CreatedDate", "FoodTypeId", "ImageUrl", "LongDescription", "Name", "Price", "RestaurantId", "ShortDescription", "UpdatedBy", "UpdatedDate" }, 67 | values: new object[,] 68 | { 69 | { 5L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 1L, "asian-food-bowl-cuisine-699953.jpg", "We use only fresh big prawns and ingredients to cook the best prawn noodle in the town.", "Prawn Noodle", 6.00m, 1L, "Fresh prawn and ingredients", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 70 | { 7L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 1L, "barbecue-bbq-cooking-111131.jpg", "", "Skewed Meat", 7.00m, 1L, "Juicy skewed meat with secret sauce", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 71 | { 11L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 1L, "bowl-cooking-cuisine-698549.jpg", "", "Chasiu Noodle", 5.00m, 1L, "A normal Chasiu Noodle", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 72 | { 17L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 1L, "chicken-close-up-crispy-60616.jpg", "", "Crispy Fried Chicken", 5.00m, 1L, "Crispy Fried Chicken", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 73 | { 19L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 1L, "chopsticks-cuisine-dinner-46247.jpg", "", "Pad Thai", 5.00m, 1L, "Pad Thai", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) } 74 | }); 75 | 76 | migrationBuilder.UpdateData( 77 | table: "Restaurants", 78 | keyColumn: "Id", 79 | keyValue: 1L, 80 | columns: new[] { "CreatedDate", "Name", "UpdatedDate" }, 81 | values: new object[] { new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), "Authentic Asian Food Restaurant", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }); 82 | 83 | migrationBuilder.InsertData( 84 | table: "Restaurants", 85 | columns: new[] { "Id", "Address", "CreatedBy", "CreatedDate", "ImageUrl", "Name", "UpdatedBy", "UpdatedDate" }, 86 | values: new object[] { 2L, null, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), null, "Western Food Restaurant", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }); 87 | 88 | migrationBuilder.InsertData( 89 | table: "Foods", 90 | columns: new[] { "Id", "CreatedBy", "CreatedDate", "FoodTypeId", "ImageUrl", "LongDescription", "Name", "Price", "RestaurantId", "ShortDescription", "UpdatedBy", "UpdatedDate" }, 91 | values: new object[,] 92 | { 93 | { 2L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 5L, "appetizer-bowl-breakfast-280018.jpg", null, "Healthy Breakfast Wrap", 8.00m, 2L, "A healthy simple breakfast for wrap lover!", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 94 | { 3L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 3L, "appetizer-chicken-chicken-dippers-1059943.jpg", "Something you cannot miss as an appetizer", "Chicken Dipper", 4.00m, 2L, "Delicious snack fried chicken dipper with mayonnaise sauce", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 95 | { 4L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 3L, "appetizer-close-up-cucumber-406152.jpg", "Good for vegan", "Vegetables Salad", 5.00m, 2L, "Only vegetables", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 96 | { 6L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 4L, "bakery-baking-blueberries-291528.jpg", "Delicious blueberry chocolate cake for birthday and any party occassions.", "Blueberry Chocolate Cake", 30.00m, 2L, "Baked with love!", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 97 | { 8L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 3L, "basil-close-up-cooking-725997.jpg", "", "Tomato Prawn Spaghetti", 13.00m, 2L, "Spaghetti with tomato sauce and prawns", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 98 | { 9L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 2L, "beef-bread-burger-156114.jpg", "", "Big beef cheeseburger", 15.00m, 2L, "A full big beef cheeseburger for dinner", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 99 | { 10L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 5L, "blur-breakfast-close-up-376464.jpg", "", "Pancake", 4.00m, 2L, "Just a pancake", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 100 | { 12L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 5L, "bread-breakfast-bun-461382.jpg", "", "Ham Sandwich", 7.00m, 2L, "Ham Sandwich", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 101 | { 13L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 5L, "breakfast-chocolate-cream-264727.jpg", "", "Crepe", 7.00m, 2L, "Colorful Crepe for breakfast", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 102 | { 14L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 5L, "burrito-chicken-close-up-461198.jpg", "", "Buritto Chicken", 6.00m, 2L, "Buritto Chicken", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 103 | { 15L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 6L, "cheese-close-up-crust-1146760.jpg", "", "Pizza", 13.00m, 2L, "Pizza lover", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 104 | { 16L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 3L, "chicken-chips-delicious-7782.jpg", "", "Chicken & Chips", 5.00m, 2L, "Chicken & Chips", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 105 | { 18L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 7L, "chicken-dinner-dish-236781.jpg", "", "Roast Chicken with Potatoes", 12.00m, 2L, "Roast Chicken with Potatoes", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 106 | { 20L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 7L, "close-up-cooking-dinner-46239.jpg", "", "Baked Salmon", 9.00m, 2L, "Baked Salmon", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) }, 107 | { 21L, "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local), 4L, "cream-dessert-glass-8382.jpg", "", "Strawberry Yogurt", 8.00m, 2L, "Strawberry Yogurt", "seed", new DateTime(2018, 11, 20, 22, 37, 44, 577, DateTimeKind.Local) } 108 | }); 109 | } 110 | 111 | protected override void Down(MigrationBuilder migrationBuilder) 112 | { 113 | migrationBuilder.DeleteData( 114 | table: "Foods", 115 | keyColumn: "Id", 116 | keyValue: 2L); 117 | 118 | migrationBuilder.DeleteData( 119 | table: "Foods", 120 | keyColumn: "Id", 121 | keyValue: 3L); 122 | 123 | migrationBuilder.DeleteData( 124 | table: "Foods", 125 | keyColumn: "Id", 126 | keyValue: 4L); 127 | 128 | migrationBuilder.DeleteData( 129 | table: "Foods", 130 | keyColumn: "Id", 131 | keyValue: 5L); 132 | 133 | migrationBuilder.DeleteData( 134 | table: "Foods", 135 | keyColumn: "Id", 136 | keyValue: 6L); 137 | 138 | migrationBuilder.DeleteData( 139 | table: "Foods", 140 | keyColumn: "Id", 141 | keyValue: 7L); 142 | 143 | migrationBuilder.DeleteData( 144 | table: "Foods", 145 | keyColumn: "Id", 146 | keyValue: 8L); 147 | 148 | migrationBuilder.DeleteData( 149 | table: "Foods", 150 | keyColumn: "Id", 151 | keyValue: 9L); 152 | 153 | migrationBuilder.DeleteData( 154 | table: "Foods", 155 | keyColumn: "Id", 156 | keyValue: 10L); 157 | 158 | migrationBuilder.DeleteData( 159 | table: "Foods", 160 | keyColumn: "Id", 161 | keyValue: 11L); 162 | 163 | migrationBuilder.DeleteData( 164 | table: "Foods", 165 | keyColumn: "Id", 166 | keyValue: 12L); 167 | 168 | migrationBuilder.DeleteData( 169 | table: "Foods", 170 | keyColumn: "Id", 171 | keyValue: 13L); 172 | 173 | migrationBuilder.DeleteData( 174 | table: "Foods", 175 | keyColumn: "Id", 176 | keyValue: 14L); 177 | 178 | migrationBuilder.DeleteData( 179 | table: "Foods", 180 | keyColumn: "Id", 181 | keyValue: 15L); 182 | 183 | migrationBuilder.DeleteData( 184 | table: "Foods", 185 | keyColumn: "Id", 186 | keyValue: 16L); 187 | 188 | migrationBuilder.DeleteData( 189 | table: "Foods", 190 | keyColumn: "Id", 191 | keyValue: 17L); 192 | 193 | migrationBuilder.DeleteData( 194 | table: "Foods", 195 | keyColumn: "Id", 196 | keyValue: 18L); 197 | 198 | migrationBuilder.DeleteData( 199 | table: "Foods", 200 | keyColumn: "Id", 201 | keyValue: 19L); 202 | 203 | migrationBuilder.DeleteData( 204 | table: "Foods", 205 | keyColumn: "Id", 206 | keyValue: 20L); 207 | 208 | migrationBuilder.DeleteData( 209 | table: "Foods", 210 | keyColumn: "Id", 211 | keyValue: 21L); 212 | 213 | migrationBuilder.DeleteData( 214 | table: "FoodTypes", 215 | keyColumn: "Id", 216 | keyValue: 7L); 217 | 218 | migrationBuilder.DeleteData( 219 | table: "Restaurants", 220 | keyColumn: "Id", 221 | keyValue: 2L); 222 | 223 | migrationBuilder.UpdateData( 224 | table: "FoodTypes", 225 | keyColumn: "Id", 226 | keyValue: 1L, 227 | columns: new[] { "CreatedDate", "UpdatedDate" }, 228 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 102, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 229 | 230 | migrationBuilder.UpdateData( 231 | table: "FoodTypes", 232 | keyColumn: "Id", 233 | keyValue: 2L, 234 | columns: new[] { "CreatedDate", "UpdatedDate" }, 235 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 236 | 237 | migrationBuilder.UpdateData( 238 | table: "FoodTypes", 239 | keyColumn: "Id", 240 | keyValue: 3L, 241 | columns: new[] { "CreatedDate", "UpdatedDate" }, 242 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 243 | 244 | migrationBuilder.UpdateData( 245 | table: "FoodTypes", 246 | keyColumn: "Id", 247 | keyValue: 4L, 248 | columns: new[] { "CreatedDate", "UpdatedDate" }, 249 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 250 | 251 | migrationBuilder.UpdateData( 252 | table: "FoodTypes", 253 | keyColumn: "Id", 254 | keyValue: 5L, 255 | columns: new[] { "CreatedDate", "UpdatedDate" }, 256 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 257 | 258 | migrationBuilder.UpdateData( 259 | table: "FoodTypes", 260 | keyColumn: "Id", 261 | keyValue: 6L, 262 | columns: new[] { "CreatedDate", "UpdatedDate" }, 263 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 103, DateTimeKind.Local) }); 264 | 265 | migrationBuilder.UpdateData( 266 | table: "Foods", 267 | keyColumn: "Id", 268 | keyValue: 1L, 269 | columns: new[] { "CreatedDate", "UpdatedDate" }, 270 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) }); 271 | 272 | migrationBuilder.UpdateData( 273 | table: "Restaurants", 274 | keyColumn: "Id", 275 | keyValue: 1L, 276 | columns: new[] { "CreatedDate", "Name", "UpdatedDate" }, 277 | values: new object[] { new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local), "Authentic Korean Food Restaurant", new DateTime(2018, 11, 10, 22, 24, 16, 104, DateTimeKind.Local) }); 278 | } 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /FoodDelivery/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FoodDelivery.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /FoodDelivery/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace FoodDelivery 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /FoodDelivery/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:54926", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "FoodDelivery": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /FoodDelivery/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using FoodDelivery.Repository; 6 | using FoodDelivery.Service.Foods; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.AspNetCore.Hosting; 9 | using Microsoft.AspNetCore.Http; 10 | using Microsoft.AspNetCore.Mvc; 11 | using Microsoft.AspNetCore.SpaServices.Webpack; 12 | using Microsoft.EntityFrameworkCore; 13 | using Microsoft.Extensions.Configuration; 14 | using Microsoft.Extensions.DependencyInjection; 15 | 16 | namespace FoodDelivery 17 | { 18 | public class Startup 19 | { 20 | public Startup(IConfiguration configuration) 21 | { 22 | Configuration = configuration; 23 | } 24 | 25 | public IConfiguration Configuration { get; } 26 | 27 | // This method gets called by the runtime. Use this method to add services to the container. 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | //call this in case you need aspnet-user-authtype/aspnet-user-identity 31 | services.AddSingleton(); 32 | 33 | services.AddDbContext(options => 34 | options.UseSqlServer(Configuration.GetConnectionString("DatabaseConnection"), 35 | builder => builder.MigrationsAssembly("FoodDelivery"))); 36 | 37 | services.Configure(options => 38 | { 39 | // This lambda determines whether user consent for non-essential cookies is needed for a given request. 40 | options.CheckConsentNeeded = context => true; 41 | options.MinimumSameSitePolicy = SameSiteMode.None; 42 | }); 43 | 44 | services.AddTransient(); 45 | services.AddTransient(); 46 | 47 | services.AddScoped(typeof(IRepository<>), typeof(Repository<>)); 48 | services.AddScoped(typeof(ApplicationDbContext)); 49 | 50 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); 51 | } 52 | 53 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 54 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 55 | { 56 | if (env.IsDevelopment()) 57 | { 58 | app.UseDeveloperExceptionPage(); 59 | } 60 | else 61 | { 62 | app.UseExceptionHandler("/Home/Error"); 63 | } 64 | 65 | app.UseStaticFiles(); 66 | app.UseCookiePolicy(); 67 | 68 | //app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions 69 | //{ 70 | // HotModuleReplacement = true 71 | //}); 72 | 73 | app.UseMvc(routes => 74 | { 75 | routes.MapRoute( 76 | name: "default", 77 | template: "{controller=Home}/{action=Index}/{id?}"); 78 | }); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /FoodDelivery/TagHelpers/FoodTypeSideBarTagHelper.cs: -------------------------------------------------------------------------------- 1 | using FoodDelivery.Core.Extensions; 2 | using FoodDelivery.Service.Foods; 3 | using Microsoft.AspNetCore.Razor.TagHelpers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace FoodDelivery.TagHelpers 11 | { 12 | [HtmlTargetElement("foodtypesidebar")] 13 | public class FoodTypeSideBarTagHelper : TagHelper 14 | { 15 | private readonly IFoodTypeService _foodTypeService; 16 | 17 | public FoodTypeSideBarTagHelper( 18 | IFoodTypeService foodTypeService 19 | ) 20 | { 21 | _foodTypeService = foodTypeService; 22 | } 23 | 24 | public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) 25 | { 26 | StringBuilder html = new StringBuilder(); 27 | html.Append("
    "); 28 | 29 | var foodTypes = await _foodTypeService.GetAvailableFoodTypesAsync(); 30 | foreach(var foodType in foodTypes) 31 | { 32 | html.Append($"
  • { foodType.Name }
  • "); 33 | } 34 | 35 | html.Append("
"); 36 | 37 | output.Content.SetHtmlContent(html.ToString()); 38 | 39 | output.TagMode = TagMode.StartTagAndEndTag; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /FoodDelivery/Views/Foods/Details.cshtml: -------------------------------------------------------------------------------- 1 | @using FoodDelivery.Data.Entities.Foods 2 | @using FoodDelivery.Core.Extensions 3 | 4 | @model Food 5 | @{ 6 | ViewData["Title"] = "Foods - " + Model.Name; 7 | } 8 | 9 | 10 |
11 |
12 | 19 |
20 |
21 |

@Model.Name

22 | 23 |
24 |
25 | 26 | 27 |
28 | 29 |
30 |
31 |
32 |

33 | @Model.ShortDescription 34 |

35 |
36 |
37 | $@Model.Price 38 |
39 |
40 |
41 | Quantity 42 |
43 |
44 |
45 | 46 |
47 |
48 |
49 | 50 |
51 | 52 |
53 |
54 |
55 |
56 |

Description

57 |
58 |
59 |

@(string.IsNullOrWhiteSpace(Model.LongDescription) ? Model.ShortDescription : Model.LongDescription)

60 |
61 |
62 | 63 |
64 |
65 |
66 |
67 | 68 | @section Scripts 69 | { 70 | 90 | } -------------------------------------------------------------------------------- /FoodDelivery/Views/Foods/FoodsByType.cshtml: -------------------------------------------------------------------------------- 1 | @using FoodDelivery.Data.Entities.Foods 2 | @using FoodDelivery.Core.Extensions 3 | @model IList 4 | @{ 5 | ViewData["Title"] = "Foods - " + ViewBag.FoodType; 6 | } 7 | 8 | 9 | 10 |
11 |
12 | 19 |
20 |
21 |

@ViewBag.FoodType

22 | 23 |
24 |
25 |
26 | 27 |
28 |
{{ food.name }}
29 |
30 | ${{ food.price }} 31 |
32 |
33 |
34 | 35 |
36 |
37 |
38 |
39 | 40 | @section Scripts 41 | { 42 | 78 | } -------------------------------------------------------------------------------- /FoodDelivery/Views/Foods/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using FoodDelivery.Data.Entities.Foods 2 | @using FoodDelivery.Core.Extensions 3 | @{ 4 | ViewData["Title"] = "Foods"; 5 | } 6 | 7 | 8 | 9 |
10 |
11 | 18 |
19 |
20 |

Foods

21 | 22 |
23 |
24 |
25 | 26 |
27 |
{{ food.name }}
28 |
29 | ${{ food.price }} 30 |
31 |
32 |
33 | 34 |
35 |
36 |
37 |
38 | 39 | @section Scripts 40 | { 41 | 75 | } -------------------------------------------------------------------------------- /FoodDelivery/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

Food Delivery

5 | 6 |

We are commited to delivery your foods on time and our foods selection are based on strict quality selection.

7 | -------------------------------------------------------------------------------- /FoodDelivery/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 | 55 | 56 | 95 | -------------------------------------------------------------------------------- /FoodDelivery/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 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 22 |

23 | -------------------------------------------------------------------------------- /FoodDelivery/Views/Shared/_CookieConsentPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Http.Features 2 | 3 | @{ 4 | var consentFeature = Context.Features.Get(); 5 | var showBanner = !consentFeature?.CanTrack ?? false; 6 | var cookieString = consentFeature?.CreateConsentCookie(); 7 | } 8 | 9 | @if (showBanner) 10 | { 11 | 33 | 41 | } -------------------------------------------------------------------------------- /FoodDelivery/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - FoodDelivery 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 42 | 43 | 44 | 45 |
46 | @RenderBody() 47 |
48 |
49 |

© 2018 - FoodDelivery

50 |
51 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 91 | 92 | @RenderSection("Scripts", required: false) 93 | 94 | 95 | -------------------------------------------------------------------------------- /FoodDelivery/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /FoodDelivery/Views/ShoppingCart/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewData["Title"] = "Index"; 4 | } 5 | 6 |

Shopping Cart

7 |

 

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 25 | 28 | 31 | 32 | 33 | 34 | 35 | 38 | 41 | 42 | 43 |
NameQuantityPrice ($)Total Price ($)
20 | {{ item.name }} 21 | 23 | 24 | 26 | {{ item.price }} 27 | 29 | {{ item.quantity * item.price }} 30 |
36 | Total 37 | 39 | {{ totalPrice() }} 40 |
44 | 45 | @section Scripts 46 | { 47 | 73 | } 74 | -------------------------------------------------------------------------------- /FoodDelivery/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using FoodDelivery 2 | @using FoodDelivery.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @addTagHelper *, FoodDelivery -------------------------------------------------------------------------------- /FoodDelivery/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /FoodDelivery/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "DatabaseConnection": "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Alvin\\Documents\\FoodDelivery.mdf;Integrated Security=True;Connect Timeout=30" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Debug", 8 | "System": "Information", 9 | "Microsoft": "Information" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /FoodDelivery/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /FoodDelivery/bundleconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "outputFileName": "css/site.min.css", 4 | "inputFiles": [ 5 | "css/site.scss" 6 | ] 7 | }, 8 | { 9 | "outputFileName": "js/site.min.js", 10 | "inputFiles": [ 11 | "js/site.js" 12 | ], 13 | "minify": { 14 | "enabled": true, 15 | "renameLocals": true 16 | }, 17 | "sourceMap": false 18 | } 19 | ] -------------------------------------------------------------------------------- /FoodDelivery/compilerconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "outputFile": "wwwroot/css/site.css", 4 | "inputFile": "wwwroot/css/site.scss" 5 | } 6 | ] -------------------------------------------------------------------------------- /FoodDelivery/compilerconfig.json.defaults: -------------------------------------------------------------------------------- 1 | { 2 | "compilers": { 3 | "less": { 4 | "autoPrefix": "", 5 | "cssComb": "none", 6 | "ieCompat": true, 7 | "strictMath": false, 8 | "strictUnits": false, 9 | "relativeUrls": true, 10 | "rootPath": "", 11 | "sourceMapRoot": "", 12 | "sourceMapBasePath": "", 13 | "sourceMap": false 14 | }, 15 | "sass": { 16 | "autoPrefix": "", 17 | "includePath": "", 18 | "indentType": "space", 19 | "indentWidth": 2, 20 | "outputStyle": "nested", 21 | "Precision": 5, 22 | "relativeUrls": true, 23 | "sourceMapRoot": "", 24 | "lineFeed": "", 25 | "sourceMap": false 26 | }, 27 | "stylus": { 28 | "sourceMap": false 29 | }, 30 | "babel": { 31 | "sourceMap": false 32 | }, 33 | "coffeescript": { 34 | "bare": false, 35 | "runtimeMode": "node", 36 | "sourceMap": false 37 | }, 38 | "handlebars": { 39 | "root": "", 40 | "noBOM": false, 41 | "name": "", 42 | "namespace": "", 43 | "knownHelpersOnly": false, 44 | "forcePartial": false, 45 | "knownHelpers": [], 46 | "commonjs": "", 47 | "amd": false, 48 | "sourceMap": false 49 | } 50 | }, 51 | "minifiers": { 52 | "css": { 53 | "enabled": true, 54 | "termSemicolons": true, 55 | "gzip": false 56 | }, 57 | "javascript": { 58 | "enabled": true, 59 | "termSemicolons": true, 60 | "gzip": false 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /FoodDelivery/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [] 5 | } -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | font-family: "Open Sans", sans-serif; } 5 | 6 | /* Wrapping element */ 7 | /* Set some basic padding to keep content from hitting the edges */ 8 | .body-content { 9 | padding-left: 15px; 10 | padding-right: 15px; } 11 | 12 | .text-bold { 13 | font-weight: bold; } 14 | 15 | .product-title { 16 | padding: 5px; } 17 | 18 | .fa-5 { 19 | font-size: 23px !important; } 20 | 21 | .sidebar { 22 | margin-top: 20px; } 23 | 24 | .spacing { 25 | margin-top: 20px; } 26 | 27 | .img-thumbnail { 28 | max-height: 140px; } 29 | 30 | /* Carousel */ 31 | .carousel-caption p { 32 | font-size: 20px; 33 | line-height: 1.4; } 34 | 35 | /* Make .svg files in the carousel display properly in older browsers */ 36 | .carousel-inner .item img[src$=".svg"] { 37 | width: 100%; } 38 | 39 | /* QR code generator */ 40 | #qrCode { 41 | margin: 15px; } 42 | 43 | /* Hide/rearrange for smaller screens */ 44 | @media screen and (max-width: 767px) { 45 | /* Hide captions */ 46 | .carousel-caption { 47 | display: none; } } 48 | 49 | .card { 50 | margin: 30px 10px 0px 10px; 51 | padding: 5px; } 52 | 53 | .card:hover { 54 | cursor: pointer; } 55 | 56 | .card-title { 57 | font-weight: bold; 58 | font-size: 16px; 59 | text-align: center; 60 | margin-top: 10px; } 61 | 62 | .card-pricing { 63 | text-align: center; 64 | font-size: 17px; 65 | color: #f64b14; 66 | font-weight: bold; } 67 | 68 | .card a { 69 | text-decoration: none; } 70 | 71 | .card-img { 72 | height: 150px; 73 | margin: auto; } 74 | 75 | .detail-pricing { 76 | font-size: 20px; 77 | color: #f64b14; 78 | font-weight: bold; } 79 | 80 | .badge-red { 81 | background-color: #f64b14; } 82 | 83 | .shopping-cart-total-amount { 84 | font-size: 25px; 85 | color: #f64b14; } 86 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px;font-family:"Open Sans",sans-serif;}.body-content{padding-left:15px;padding-right:15px;}.text-bold{font-weight:bold;}.product-title{padding:5px;}.fa-5{font-size:23px !important;}.sidebar{margin-top:20px;}.spacing{margin-top:20px;}.img-thumbnail{max-height:140px;}.carousel-caption p{font-size:20px;line-height:1.4;}.carousel-inner .item img[src$=".svg"]{width:100%;}#qrCode{margin:15px;}@media screen and (max-width:767px){.carousel-caption{display:none;}}.card{margin:30px 10px 0 10px;padding:5px;}.card:hover{cursor:pointer;}.card-title{font-weight:bold;font-size:16px;text-align:center;margin-top:10px;}.card-pricing{text-align:center;font-size:17px;color:#f64b14;font-weight:bold;}.card a{text-decoration:none;}.card-img{height:150px;margin:auto;}.detail-pricing{font-size:20px;color:#f64b14;font-weight:bold;}.badge-red{background-color:#f64b14;}.shopping-cart-total-amount{font-size:25px;color:#f64b14;} -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/css/site.scss: -------------------------------------------------------------------------------- 1 | $price-color: #f64b14; 2 | 3 | body { 4 | padding-top: 50px; 5 | padding-bottom: 20px; 6 | font-family: "Open Sans", sans-serif; 7 | } 8 | 9 | /* Wrapping element */ 10 | /* Set some basic padding to keep content from hitting the edges */ 11 | .body-content { 12 | padding-left: 15px; 13 | padding-right: 15px; 14 | } 15 | 16 | .text-bold { 17 | font-weight: bold; 18 | } 19 | 20 | .product-title { 21 | padding: 5px; 22 | } 23 | 24 | .fa-5 { 25 | font-size: 23px !important; 26 | } 27 | 28 | .sidebar { 29 | margin-top: 20px; 30 | } 31 | 32 | .spacing { 33 | margin-top: 20px; 34 | } 35 | 36 | .img-thumbnail { 37 | max-height: 140px; 38 | } 39 | 40 | /* Carousel */ 41 | .carousel-caption p { 42 | font-size: 20px; 43 | line-height: 1.4; 44 | } 45 | 46 | /* Make .svg files in the carousel display properly in older browsers */ 47 | .carousel-inner .item img[src$=".svg"] { 48 | width: 100%; 49 | } 50 | 51 | /* QR code generator */ 52 | #qrCode { 53 | margin: 15px; 54 | } 55 | 56 | /* Hide/rearrange for smaller screens */ 57 | @media screen and (max-width: 767px) { 58 | /* Hide captions */ 59 | .carousel-caption { 60 | display: none; 61 | } 62 | } 63 | 64 | .card { 65 | margin: 30px 10px 0px 10px; 66 | padding: 5px; 67 | } 68 | 69 | .card:hover { 70 | cursor: pointer; 71 | } 72 | 73 | .card-title { 74 | font-weight: bold; 75 | font-size: 16px; 76 | text-align: center; 77 | margin-top: 10px; 78 | } 79 | 80 | .card-pricing { 81 | text-align: center; 82 | font-size: 17px; 83 | color: #f64b14; 84 | font-weight: bold; 85 | } 86 | 87 | .card a { 88 | text-decoration: none; 89 | } 90 | 91 | .card-img { 92 | height: 150px; 93 | margin: auto; 94 | } 95 | 96 | .detail-pricing { 97 | font-size: 20px; 98 | color: #f64b14; 99 | font-weight: bold; 100 | } 101 | 102 | .badge-red { 103 | background-color: #f64b14; 104 | } 105 | 106 | .shopping-cart-total-amount { 107 | font-size: 25px; 108 | color: $price-color; 109 | } 110 | 111 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/favicon.ico -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/appetizer-bowl-breakfast-280018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/appetizer-bowl-breakfast-280018.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/appetizer-chicken-chicken-dippers-1059943.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/appetizer-chicken-chicken-dippers-1059943.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/appetizer-close-up-cucumber-406152.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/appetizer-close-up-cucumber-406152.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/asian-food-bowl-cuisine-699953.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/asian-food-bowl-cuisine-699953.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/bakery-baking-blueberries-291528.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/bakery-baking-blueberries-291528.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/banner1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/banner2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/banner3.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/barbecue-bbq-cooking-111131.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/barbecue-bbq-cooking-111131.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/basil-close-up-cooking-725997.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/basil-close-up-cooking-725997.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/beef-bread-burger-156114.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/beef-bread-burger-156114.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/blur-breakfast-close-up-376464.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/blur-breakfast-close-up-376464.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/bowl-cooking-cuisine-698549.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/bowl-cooking-cuisine-698549.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/bread-breakfast-bun-461382.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/bread-breakfast-bun-461382.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/breakfast-chocolate-cream-264727.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/breakfast-chocolate-cream-264727.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/burrito-chicken-close-up-461198.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/burrito-chicken-close-up-461198.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/cheese-close-up-crust-1146760.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/cheese-close-up-crust-1146760.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/chicken-chips-delicious-7782.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/chicken-chips-delicious-7782.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/chicken-close-up-crispy-60616.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/chicken-close-up-crispy-60616.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/chicken-dinner-dish-236781.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/chicken-dinner-dish-236781.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/chopsticks-cuisine-dinner-46247.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/chopsticks-cuisine-dinner-46247.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/close-up-cooking-dinner-46239.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/close-up-cooking-dinner-46239.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/cream-dessert-glass-8382.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/cream-dessert-glass-8382.jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/images/egg-food-fried-rice-53121 (1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/images/egg-food-fried-rice-53121 (1).jpg -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/js/bootstrap-notify.min.js: -------------------------------------------------------------------------------- 1 | /* Project: Bootstrap Growl = v3.1.3 | Description: Turns standard Bootstrap alerts into "Growl-like" notifications. | Author: Mouse0270 aka Robert McIntosh | License: MIT License | Website: https://github.com/mouse0270/bootstrap-growl */ 2 | !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){function e(e,i,n){var i={content:{message:"object"==typeof i?i.message:i,title:i.title?i.title:"",icon:i.icon?i.icon:"",url:i.url?i.url:"#",target:i.target?i.target:"-"}};n=t.extend(!0,{},i,n),this.settings=t.extend(!0,{},s,n),this._defaults=s,"-"==this.settings.content.target&&(this.settings.content.target=this.settings.url_target),this.animations={start:"webkitAnimationStart oanimationstart MSAnimationStart animationstart",end:"webkitAnimationEnd oanimationend MSAnimationEnd animationend"},"number"==typeof this.settings.offset&&(this.settings.offset={x:this.settings.offset,y:this.settings.offset}),this.init()}var s={element:"body",position:null,type:"info",allow_dismiss:!0,newest_on_top:!1,showProgressbar:!1,placement:{from:"top",align:"right"},offset:20,spacing:10,z_index:1031,delay:5e3,timer:1e3,url_target:"_blank",mouse_over:null,animate:{enter:"animated fadeInDown",exit:"animated fadeOutUp"},onShow:null,onShown:null,onClose:null,onClosed:null,icon_type:"class",template:''};String.format=function(){for(var t=arguments[0],e=1;e .progress-bar').removeClass("progress-bar-"+t.settings.type),t.settings.type=i[e],this.$ele.addClass("alert-"+i[e]).find('[data-notify="progressbar"] > .progress-bar').addClass("progress-bar-"+i[e]);break;case"icon":var n=this.$ele.find('[data-notify="icon"]');"class"==t.settings.icon_type.toLowerCase()?n.removeClass(t.settings.content.icon).addClass(i[e]):(n.is("img")||n.find("img"),n.attr("src",i[e]));break;case"progress":var a=t.settings.delay-t.settings.delay*(i[e]/100);this.$ele.data("notify-delay",a),this.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",i[e]).css("width",i[e]+"%");break;case"url":this.$ele.find('[data-notify="url"]').attr("href",i[e]);break;case"target":this.$ele.find('[data-notify="url"]').attr("target",i[e]);break;default:this.$ele.find('[data-notify="'+e+'"]').html(i[e])}var o=this.$ele.outerHeight()+parseInt(t.settings.spacing)+parseInt(t.settings.offset.y);t.reposition(o)},close:function(){t.close()}}},buildNotify:function(){var e=this.settings.content;this.$ele=t(String.format(this.settings.template,this.settings.type,e.title,e.message,e.url,e.target)),this.$ele.attr("data-notify-position",this.settings.placement.from+"-"+this.settings.placement.align),this.settings.allow_dismiss||this.$ele.find('[data-notify="dismiss"]').css("display","none"),(this.settings.delay<=0&&!this.settings.showProgressbar||!this.settings.showProgressbar)&&this.$ele.find('[data-notify="progressbar"]').remove()},setIcon:function(){"class"==this.settings.icon_type.toLowerCase()?this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon):this.$ele.find('[data-notify="icon"]').is("img")?this.$ele.find('[data-notify="icon"]').attr("src",this.settings.content.icon):this.$ele.find('[data-notify="icon"]').append('Notify Icon')},styleURL:function(){this.$ele.find('[data-notify="url"]').css({backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)",height:"100%",left:"0px",position:"absolute",top:"0px",width:"100%",zIndex:this.settings.z_index+1}),this.$ele.find('[data-notify="dismiss"]').css({position:"absolute",right:"10px",top:"5px",zIndex:this.settings.z_index+2})},placement:function(){var e=this,s=this.settings.offset.y,i={display:"inline-block",margin:"0px auto",position:this.settings.position?this.settings.position:"body"===this.settings.element?"fixed":"absolute",transition:"all .5s ease-in-out",zIndex:this.settings.z_index},n=!1,a=this.settings;switch(t('[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])').each(function(){return s=Math.max(s,parseInt(t(this).css(a.placement.from))+parseInt(t(this).outerHeight())+parseInt(a.spacing))}),1==this.settings.newest_on_top&&(s=this.settings.offset.y),i[this.settings.placement.from]=s+"px",this.settings.placement.align){case"left":case"right":i[this.settings.placement.align]=this.settings.offset.x+"px";break;case"center":i.left=0,i.right=0}this.$ele.css(i).addClass(this.settings.animate.enter),t.each(Array("webkit","moz","o","ms",""),function(t,s){e.$ele[0].style[s+"AnimationIterationCount"]=1}),t(this.settings.element).append(this.$ele),1==this.settings.newest_on_top&&(s=parseInt(s)+parseInt(this.settings.spacing)+this.$ele.outerHeight(),this.reposition(s)),t.isFunction(e.settings.onShow)&&e.settings.onShow.call(this.$ele),this.$ele.one(this.animations.start,function(){n=!0}).one(this.animations.end,function(){t.isFunction(e.settings.onShown)&&e.settings.onShown.call(this)}),setTimeout(function(){n||t.isFunction(e.settings.onShown)&&e.settings.onShown.call(this)},600)},bind:function(){var e=this;if(this.$ele.find('[data-notify="dismiss"]').on("click",function(){e.close()}),this.$ele.mouseover(function(){t(this).data("data-hover","true")}).mouseout(function(){t(this).data("data-hover","false")}),this.$ele.data("data-hover","false"),this.settings.delay>0){e.$ele.data("notify-delay",e.settings.delay);var s=setInterval(function(){var t=parseInt(e.$ele.data("notify-delay"))-e.settings.timer;if("false"===e.$ele.data("data-hover")&&"pause"==e.settings.mouse_over||"pause"!=e.settings.mouse_over){var i=(e.settings.delay-t)/e.settings.delay*100;e.$ele.data("notify-delay",t),e.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",i).css("width",i+"%")}t<=-e.settings.timer&&(clearInterval(s),e.close())},e.settings.timer)}},close:function(){var e=this,s=parseInt(this.$ele.css(this.settings.placement.from)),i=!1;this.$ele.data("closing","true").addClass(this.settings.animate.exit),e.reposition(s),t.isFunction(e.settings.onClose)&&e.settings.onClose.call(this.$ele),this.$ele.one(this.animations.start,function(){i=!0}).one(this.animations.end,function(){t(this).remove(),t.isFunction(e.settings.onClosed)&&e.settings.onClosed.call(this)}),setTimeout(function(){i||(e.$ele.remove(),e.settings.onClosed&&e.settings.onClosed(e.$ele))},600)},reposition:function(e){var s=this,i='[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])',n=this.$ele.nextAll(i);1==this.settings.newest_on_top&&(n=this.$ele.prevAll(i)),n.each(function(){t(this).css(s.settings.placement.from,e),e=parseInt(e)+parseInt(s.settings.spacing)+t(this).outerHeight()})}}),t.notify=function(t,s){var i=new e(this,t,s);return i.notify},t.notifyDefaults=function(e){return s=t.extend(!0,{},s,e)},t.notifyClose=function(e){"undefined"==typeof e||"all"==e?t("[data-notify]").find('[data-notify="dismiss"]').trigger("click"):t('[data-notify-position="'+e+'"]').find('[data-notify="dismiss"]').trigger("click")}}); -------------------------------------------------------------------------------- /FoodDelivery/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 | 6 | const shoppingCartStore = new Vuex.Store({ 7 | state: { 8 | cart: [] 9 | }, 10 | mutations: { 11 | addToCart(state, item) { 12 | var found = state.cart.find(product => product.id == item.id); 13 | 14 | if (found) { 15 | if (found.quantity == null) { 16 | found.quantity = 0; 17 | } 18 | 19 | found.quantity = parseInt(found.quantity) + parseInt(item.quantity); 20 | } else { 21 | state.cart.push(item); 22 | 23 | Vue.set(item, 'quantity', item.quantity); 24 | } 25 | 26 | shoppingCartBadgeApp.quantity = state.cart.length; 27 | 28 | $.notify({ 29 | // options 30 | message: 'Your item ' + item.name + ' has been added to shopping cart!' 31 | }, 32 | { 33 | // settings 34 | type: 'success', 35 | allow_dismiss: true, 36 | timer: 500, 37 | }); 38 | }, 39 | saveCart(state) { 40 | localStorage.setItem("cart", JSON.stringify(state.cart)); 41 | } 42 | }, 43 | getters: { 44 | getCart: state => { 45 | state.cart = JSON.parse(localStorage.getItem("cart")); 46 | if (state.cart == null) { 47 | state.cart = []; 48 | } 49 | 50 | return state.cart; 51 | } 52 | }, 53 | }); -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/js/site.min.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 | 6 | const shoppingCartStore = new Vuex.Store({ 7 | state: { 8 | cart: [] 9 | }, 10 | mutations: { 11 | getCart() { 12 | state.cart = JSON.parse(localStorage.getItem("cart")); 13 | if (state.cart == null) { 14 | state.cart = []; 15 | } 16 | }, 17 | addToCart(state, item) { 18 | var found = state.cart.find(product => product.id == item.id); 19 | 20 | if (found) { 21 | found.quantity++; 22 | found.totalPrice = found.quantity * found.price; 23 | } else { 24 | state.cart.push(item); 25 | 26 | Vue.set(item, 'quantity', 1); 27 | Vue.set(item, 'totalPrice', item.price); 28 | } 29 | }, 30 | saveCart(state) { 31 | localStorage.setItem("cart", JSON.stringify(state.cart)); 32 | } 33 | } 34 | }); -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | }, 34 | "version": "3.3.7", 35 | "_release": "3.3.7", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.3.7", 39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" 40 | }, 41 | "_source": "https://github.com/twbs/bootstrap.git", 42 | "_target": "v3.3.7", 43 | "_originalSource": "bootstrap", 44 | "_direct": true 45 | } -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2016 Twitter, Inc. 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvinlimcode/FoodDelivery/f468d08a2861ecee865a0128cf753510195ddd7d/FoodDelivery/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/jquery-validation-unobtrusive/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation-unobtrusive", 3 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", 4 | "version": "3.2.9", 5 | "_release": "3.2.9", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v3.2.9", 9 | "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396" 10 | }, 11 | "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git", 12 | "_target": "^3.2.9", 13 | "_originalSource": "jquery-validation-unobtrusive", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /FoodDelivery/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 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | // Unobtrusive validation support library for jQuery and jQuery Validate 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // @version v3.2.9 4 | !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}); -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/jquery-validation/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation", 3 | "homepage": "https://jqueryvalidation.org/", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/jquery-validation/jquery-validation.git" 7 | }, 8 | "authors": [ 9 | "Jörn Zaefferer " 10 | ], 11 | "description": "Form validation made easy", 12 | "main": "dist/jquery.validate.js", 13 | "keywords": [ 14 | "forms", 15 | "validation", 16 | "validate" 17 | ], 18 | "license": "MIT", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "demo", 25 | "lib" 26 | ], 27 | "dependencies": { 28 | "jquery": ">= 1.7.2" 29 | }, 30 | "version": "1.17.0", 31 | "_release": "1.17.0", 32 | "_resolution": { 33 | "type": "version", 34 | "tag": "1.17.0", 35 | "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772" 36 | }, 37 | "_source": "https://github.com/jzaefferer/jquery-validation.git", 38 | "_target": "^1.17.0", 39 | "_originalSource": "jquery-validation", 40 | "_direct": true 41 | } -------------------------------------------------------------------------------- /FoodDelivery/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 | -------------------------------------------------------------------------------- /FoodDelivery/wwwroot/lib/jquery-validation/dist/additional-methods.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Validation Plugin - v1.17.0 - 7/29/2017 2 | * https://jqueryvalidation.org/ 3 | * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */ 4 | !function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;e<=9;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;e<=10;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c