Skip to content

Commit

Permalink
Merge pull request #462 from dotnet/salvage-401
Browse files Browse the repository at this point in the history
Update PointOfSale App
  • Loading branch information
jfversluis authored Apr 5, 2024
2 parents 6cfa4a4 + e5aa6a3 commit 85644dc
Show file tree
Hide file tree
Showing 69 changed files with 1,342 additions and 221 deletions.
9 changes: 8 additions & 1 deletion 8.0/Apps/PointOfSale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ languages:
- xaml
products:
- dotnet-maui
- dotnet-core
urlFragment: apps-pointofsale
---

Expand All @@ -20,6 +21,12 @@ This app demonstrates various techniques for building a desktop and mobile appli

![food-mobile-2](https://user-images.githubusercontent.com/41873/183740348-7f55d10d-8f79-4ee0-a71e-64b317cbd64f.png)

## Local Testing

If you want to test the full functionality of this app locally for iOS, make sure to rename the `Platforms/iOS/EntitlementsSample.plist` file to ``Platforms/iOS/Entitlements.plist`.

By doing so, you will need a matching provisioning profile in your Apple Developer accound in order for everything to work correctly.

### Credits

* Original design: https://www.uplabs.com/posts/foodos-food-point-of-sale
Expand All @@ -30,4 +37,4 @@ This app demonstrates various techniques for building a desktop and mobile appli
* CommunityToolkit.Maui: https://github.com/CommunityToolkit/Maui
* SkiaSharp & Lottie: https://mono.github.io/SkiaSharp.Extended/api/ui-maui/#sklottieview
* MicroCharts: https://github.com/microcharts-dotnet/Microcharts
* Ril.BlazorSignatureCanvas: https://github.com/ResourceWare/Ril.BlazorSignatureCanvas
* Ril.BlazorSignatureCanvas: https://github.com/ResourceWare/Ril.BlazorSignatureCanvas
22 changes: 22 additions & 0 deletions 8.0/Apps/PointOfSale/src/PointOfSale.API/PointOfSale.API.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' " />
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' " />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Datasync" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Datasync.EFCore" Version="5.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Identity.Web" Version="2.0.7-preview" />
</ItemGroup>

</Project>
38 changes: 38 additions & 0 deletions 8.0/Apps/PointOfSale/src/PointOfSale.API/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// Licensed under the MIT License.

using System;
using Microsoft.AspNetCore.Datasync;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;
//using TodoAppService.NET6.Db;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration);
builder.Services.AddAuthorization();
//var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");

//if (connectionString == null)
//{
// throw new ApplicationException("DefaultConnection is not set");
//}

//builder.Services.AddDbContext<AppDbContext>(options => options.UseSqlServer(connectionString));
//builder.Services.AddDatasyncControllers();

var app = builder.Build();

// Initialize the database
//using (var scope = app.Services.CreateScope())
//{
// var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
// await context.InitializeDatabaseAsync().ConfigureAwait(false);
//}

// Configure and run the web service.
app.UseAuthentication();
app.UseAuthorization();
//app.MapControllers();
app.Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64228",
"sslPort": 44388
}
},
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5128",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7111;http://localhost:5128",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

18 changes: 18 additions & 0 deletions 8.0/Apps/PointOfSale/src/PointOfSale.API/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"AzureAD": {
"Instance": "https://login.microsoftonline.com",
"ClientId": "4c5a1b86-86f9-431a-a99d-999024e16848",
"TenantId": "common"
},
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=TodoApp;Trusted_Connection=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

164 changes: 164 additions & 0 deletions 8.0/Apps/PointOfSale/src/PointOfSale.API/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"skuName": {
"type": "string",
"defaultValue": "F1",
"allowedValues": [
"F1",
"D1",
"B1",
"B2",
"B3",
"S1",
"S2",
"S3",
"P1",
"P2",
"P3",
"P4"
],
"metadata": {
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
}
},
"skuCapacity": {
"type": "int",
"defaultValue": 1,
"maxValue": 3,
"minValue": 1,
"metadata": {
"description": "Describes plan's instance count"
}
},
"sqlAdministratorLogin": {
"type": "string",
"defaultValue": "appadmin",
"metadata": {
"description": "The admin user of the SQL Server"
}
},
"sqlPassword": {
"type": "secureString",
"metadata": {
"description": "The password of the admin user of the SQL Server"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"hostingPlanName": "[format('{0}hosting', uniqueString(resourceGroup().id))]",
"websiteName": "[format('{0}-service', uniqueString(resourceGroup().id))]",
"sqlserverName": "[format('{0}-dbserver', uniqueString(resourceGroup().id))]",
"databaseName": "quickstart"
},
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2021-02-01-preview",
"name": "[variables('sqlserverName')]",
"location": "[parameters('location')]",
"properties": {
"administratorLogin": "[parameters('sqlAdministratorLogin')]",
"administratorLoginPassword": "[parameters('sqlPassword')]",
"version": "12.0"
}
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2021-02-01-preview",
"name": "[format('{0}/{1}', variables('sqlserverName'), variables('databaseName'))]",
"location": "[parameters('location')]",
"sku": {
"name": "Basic"
},
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": 1073741824
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]"
]
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2021-02-01-preview",
"name": "[format('{0}/{1}', variables('sqlserverName'), 'AllowAllWindowsAzureIps')]",
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]"
]
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2021-03-01",
"name": "[variables('hostingPlanName')]",
"location": "[parameters('location')]",
"tags": {
"displayName": "HostingPlan"
},
"sku": {
"name": "[parameters('skuName')]",
"capacity": "[parameters('skuCapacity')]"
},
"properties": {
"numberOfWorkers": 1
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2021-03-01",
"name": "[variables('websiteName')]",
"location": "[parameters('location')]",
"tags": {
"[format('hidden-related:{0}', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty",
"displayName": "Website"
},
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}', variables('websiteName'), 'connectionstrings')]",
"properties": {
"DefaultConnection": {
"value": "[format('Data Source=tcp:{0},1433;Initial Catalog={1};User Id={2}@{3};Password={4};', reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, variables('databaseName'), parameters('sqlAdministratorLogin'), reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, parameters('sqlPassword'))]",
"type": "SQLAzure"
}
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]",
"[resourceId('Microsoft.Web/sites', variables('websiteName'))]"
]
}
],
"outputs": {
"backendUrl": {
"type": "string",
"value": "[concat('https://', variables('websiteName'), '.azurewebsites.net')]"
},
"sqlUsername": {
"type": "string",
"value": "[parameters('sqlAdministratorLogin')]"
},
"sqlPassword": {
"type": "string",
"value": "[parameters('sqlPassword')]"
}
}
}
6 changes: 6 additions & 0 deletions 8.0/Apps/PointOfSale/src/PointOfSale.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PointOfSale", "PointOfSale\PointOfSale.csproj", "{88F24BAD-E7CD-4D00-87F4-702FE9AA7077}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PointOfSale.API", "PointOfSale.API\PointOfSale.API.csproj", "{E093156C-2134-4AE3-8C14-96CE94725BBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -17,6 +19,10 @@ Global
{88F24BAD-E7CD-4D00-87F4-702FE9AA7077}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88F24BAD-E7CD-4D00-87F4-702FE9AA7077}.Release|Any CPU.Build.0 = Release|Any CPU
{88F24BAD-E7CD-4D00-87F4-702FE9AA7077}.Release|Any CPU.Deploy.0 = Release|Any CPU
{E093156C-2134-4AE3-8C14-96CE94725BBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E093156C-2134-4AE3-8C14-96CE94725BBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E093156C-2134-4AE3-8C14-96CE94725BBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E093156C-2134-4AE3-8C14-96CE94725BBF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 0 additions & 14 deletions 8.0/Apps/PointOfSale/src/PointOfSale/.vscode/launch.json

This file was deleted.

Loading

0 comments on commit 85644dc

Please sign in to comment.