Skip to content

This GitHub repository contains a project built using several design patterns and technologies such as Onion Architecture, Generic Repository Design Pattern, CQRS, Mediator Pattern, Entity Framework Core-Code First, ASP.NET Core 6 API, MSSQL, and Swagger UI.

Notifications You must be signed in to change notification settings

srknea/aspnet-CarrierSelectApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ECommerceAPI

ECommerceAPI is a .NET API project that automatically selects a shipping carrier based on the weight (desi) information entered by the customer during the order placement process.

When a customer creates an order, the API calculates the shipping cost based on the weight of the order using the predefined data associated with the shipping carriers. The calculated shipping cost and relevant data are then stored in the order table.

Orders

The necessary parameters are filled in to add a record to the database.

  1. If the order's weight falls within the MinWeight-MaxWeight range of any carrier:
    a. The price values of that carrier should be retrieved and recorded as the shipping cost for the order. The carrier with the lowest cost among the identified carriers should be selected.

  2. If the order's weight does not fall within the MinWeight-MaxWeight range of any carrier:
    a. The data of the carrier that has the weight closest to the order's weight, from the CarrierConfigurations table, is retrieved using appropriate queries.
    b. The price and +1 weight cost information of the retrieved record(s) are obtained.
    c. The difference between the order's weight and the closest weight value of the carrier obtained in step A is calculated.
    d. The difference value obtained in step C is multiplied by the +1 weight cost, and then added to the base shipping cost. This ensures the appropriate pricing for each additional weight unit exceeding the carrier's standard weight range.
    e. The value obtained in step D is recorded in the database as the shipping cost for the order.

To better understand the logical operations involved, you can refer to the following example:

Order Weight: 13
Carrier Min-Max Weight Range: 1-10
Shipping Cost for the Relevant Weight Range: $32
+1 Weight Cost: $4
Calculated Final Shipping Cost (to be recorded in the Order table): $32 + ($4 * (13-10) ) = $44

Please note that the above explanation assumes a weight-based pricing model for the shipping costs.

Tables

Carrier Table

Variable Name Data Type
Id int
CarrierName nvarchar
CarrierIsActive bit
CarrierPlusDesiCost int

CarrierConfiguration Table

Variable Name Data Type
Id int
CarrierMaxDesi int
CarrierMaxDesi int
CarrierCost decimal
CarrierId int

Order Table

Variable Name Data Type
Id int
OrderDesi int
OrderDate datetime
OrderCarrierCost decimal
CarrierId int

About

This GitHub repository contains a project built using several design patterns and technologies such as Onion Architecture, Generic Repository Design Pattern, CQRS, Mediator Pattern, Entity Framework Core-Code First, ASP.NET Core 6 API, MSSQL, and Swagger UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages