Skip to content

Commit

Permalink
fix double?
Browse files Browse the repository at this point in the history
  • Loading branch information
tungcbh committed Aug 31, 2024
1 parent 2037958 commit 02ee94d
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Bulky.Models/ApplicationUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public class ApplicationUser : IdentityUser
public int? CompanyId { get; set; }
[ForeignKey("CompanyId")]
[ValidateNever]
public Company Company { get; set; }
public Company? Company { get; set; }
}
}
4 changes: 2 additions & 2 deletions Bulky.Models/OrderDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class OrderDetail
[ValidateNever]
public Product? Product { get; set; }

public int? Count { get; set; }
public double? Price { get; set; }
public int Count { get; set; }
public double Price { get; set; }
}
}
2 changes: 1 addition & 1 deletion Bulky.Models/OrderHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class OrderHeader

public DateTime OrderDate { get; set; }
public DateTime ShippingDate { get; set; }
public double? OrderTotal { get; set; }
public double OrderTotal { get; set; }
public string? OrderStatus { get; set; }
public string? PaymentStatus { get; set; }

Expand Down
10 changes: 5 additions & 5 deletions Bulky.Models/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ public class Product
[Required]
[Display(Name = "List Price")]
[Range(1, 1000)]
public double? ListPrice { get; set; }
public double ListPrice { get; set; }

[Required]
[Display(Name = "Price for 1-50")]
[Range(1, 1000)]
public double? Price { get; set; }
public double Price { get; set; }


[Required]
[Display(Name = "Price for 50+")]
[Range(1, 1000)]
public double? Price50 { get; set; }
public double Price50 { get; set; }

[Required]
[Display(Name = "Price for 100+")]
[Range(1, 1000)]
public double? Price100 { get; set; }
public double Price100 { get; set; }
[Required]
[Display(Name = "Category")]
public int? CategoryId { get; set; }
[ForeignKey("CategoryId")]
[ValidateNever]
public Category? Category { get; set; }
public Category Category { get; set; }

Check warning on line 47 in Bulky.Models/Product.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Category' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
[ValidateNever]
public string? ImageURL { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions Bulky.Models/ShoppingCart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ShoppingCart
public int Id { get; set; }
[Required]
[Range(1, 1000, ErrorMessage = "Please enter a value between 1 and 1000.")]
public int? Count { get; set; }
public int Count { get; set; }
public int? ProductId { get; set; }
[ForeignKey("ProductId")]
[ValidateNever]
Expand All @@ -21,6 +21,6 @@ public class ShoppingCart
public ApplicationUser? ApplicationUser { get; set; }

[NotMapped]
public double? Price { get; set; }
public double Price { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "DefaultResourceGroup-EUS2",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "eastus2",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('BulkyWeb_db', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"kind": "v12.0",
"location": "[parameters('resourceLocation')]",
"name": "bulkywebdb",
"type": "Microsoft.Sql/servers",
"apiVersion": "2017-10-01-preview"
},
{
"sku": {
"name": "Standard",
"tier": "Standard",
"capacity": 10
},
"kind": "v12.0,user",
"location": "[parameters('resourceLocation')]",
"name": "bulkywebdb/BulkyWeb_db",
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2017-10-01-preview",
"dependsOn": [
"bulkywebdb"
]
}
]
}
}
}
],
"metadata": {
"_dependencyType": "mssql.azure"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dependencies": {
"mssql1": {
"serviceConnectorResourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Web/sites/BulkyWebAppService01092024/providers/Microsoft.ServiceLinker/linkers/ConnectionStringsAzureDb_71A18EBE74",
"secretStore": "AzureAppSettings",
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourcegroups/[parameters('resourceGroupName')]/providers/Microsoft.Sql/servers/bulkywebdb/databases/BulkyWeb_db",
"type": "mssql.azure",
"connectionId": "ConnectionStrings:AzureDb"
}
}
}
7 changes: 6 additions & 1 deletion BulkyWeb/Properties/serviceDependencies.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"dependencies": {}
"dependencies": {
"mssql1": {
"type": "mssql",
"connectionId": "ConnectionStrings:AzureDb"
}
}
}

0 comments on commit 02ee94d

Please sign in to comment.