If you have any further questions, you can contact us 501-222-2222.
18 |
19 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Confirmation.cshtml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc.RazorPages;
2 |
3 | namespace AspnetRunBasics
4 | {
5 | public class ConfirmationModel : PageModel
6 | {
7 | public string Message { get; set; }
8 |
9 | public void OnGetContact()
10 | {
11 | Message = "Your email was sent.";
12 | }
13 |
14 | public void OnGetOrderSubmitted()
15 | {
16 | Message = "Your order submitted successfully.";
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Services/ICatalogService.cs:
--------------------------------------------------------------------------------
1 | using AspnetRunBasics.Models;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 |
5 | namespace AspnetRunBasics.Services
6 | {
7 | public interface ICatalogService
8 | {
9 | Task> GetCatalog();
10 | Task> GetCatalogByCategory(string category);
11 | Task GetCatalog(string id);
12 | Task CreateCatalog(CatalogModel model);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.API/Discount - Backup.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/BuildingBlocks/EventBus.Messages/Events/IntegrationBaseEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventBus.Messages.Events
4 | {
5 | public class IntegrationBaseEvent
6 | {
7 | public IntegrationBaseEvent()
8 | {
9 | Id = Guid.NewGuid();
10 | CreationDate = DateTime.UtcNow;
11 | }
12 |
13 | public IntegrationBaseEvent(Guid id, DateTime createDate)
14 | {
15 | Id = id;
16 | CreationDate = createDate;
17 | }
18 |
19 | public Guid Id { get; private set; }
20 |
21 | public DateTime CreationDate { get; private set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Queries/GetOrdersList/GetOrdersListQuery.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace Ordering.Application.Features.Orders.Queries.GetOrdersList
6 | {
7 | public class GetOrdersListQuery : IRequest>
8 | {
9 | public string UserName { get; set; }
10 |
11 | public GetOrdersListQuery(string userName)
12 | {
13 | UserName = userName ?? throw new ArgumentNullException(nameof(userName));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.API/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "OrderingConnectionString": "Server=localhost;Database=OrderDb;User Id=sa;Password=SwN12345678;"
4 | },
5 | "EmailSettings": {
6 | "FromAddress": "ezozkme@gmail.com",
7 | "ApiKey": "",
8 | "FromName": "Mehmet"
9 | },
10 | "EventBusSettings": {
11 | "HostAddress": "amqp://guest:guest@localhost:5672"
12 | },
13 | "Logging": {
14 | "LogLevel": {
15 | "Default": "Information",
16 | "Microsoft": "Warning",
17 | "Microsoft.Hosting.Lifetime": "Information"
18 | }
19 | },
20 | "AllowedHosts": "*"
21 | }
22 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Hosting;
3 |
4 | namespace AspnetRunBasics
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | CreateHostBuilder(args).Build().Run();
11 | }
12 |
13 | public static IHostBuilder CreateHostBuilder(string[] args) =>
14 | Host.CreateDefaultBuilder(args)
15 | .ConfigureWebHostDefaults(webBuilder =>
16 | {
17 | webBuilder.UseStartup();
18 | });
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/AspnetRunBasics.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | cd5124f0-00bb-4cff-b8b9-dc4e11396fa3
6 | Linux
7 | ..\..\docker-compose.dcproj
8 | ..\..
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\docker-compose.dcproj
6 | Linux
7 | ..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Privacy.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.AspNetCore.Mvc.RazorPages;
7 | using Microsoft.Extensions.Logging;
8 |
9 | namespace AspnetRunBasics.Pages
10 | {
11 | public class PrivacyModel : PageModel
12 | {
13 | private readonly ILogger _logger;
14 |
15 | public PrivacyModel(ILogger logger)
16 | {
17 | _logger = logger;
18 | }
19 |
20 | public void OnGet()
21 | {
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Models/BasketItemExtendedModel.cs:
--------------------------------------------------------------------------------
1 | namespace Shopping.Aggregator.Models
2 | {
3 | public class BasketItemExtendedModel
4 | {
5 | public int Quantity { get; set; }
6 | public string Color { get; set; }
7 | public decimal Price { get; set; }
8 | public string ProductId { get; set; }
9 | public string ProductName { get; set; }
10 |
11 | //Product Related Additional Fields
12 | public string Category { get; set; }
13 | public string Summary { get; set; }
14 | public string Description { get; set; }
15 | public string ImageFile { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Repositories/IProductRepository.cs:
--------------------------------------------------------------------------------
1 | using Catalog.API.Entities;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 |
5 | namespace Catalog.API.Repositories
6 | {
7 | public interface IProductRepository
8 | {
9 | Task> GetProducts();
10 | Task GetProduct(string id);
11 | Task> GetProductByName(string name);
12 | Task> GetProductByCategory(string categoryName);
13 |
14 | Task CreateProduct(Product product);
15 | Task UpdateProduct(Product product);
16 | Task DeleteProduct(string id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/ApiGateways/OcelotApiGw/OcelotApiGw.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\docker-compose.dcproj
6 | Linux
7 | ..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Catalog.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 | Linux
7 | ..\..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Mappings/MappingProfile.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Ordering.Application.Features.Orders.Commands.CheckoutOrder;
3 | using Ordering.Application.Features.Orders.Commands.UpdateOrder;
4 | using Ordering.Application.Features.Orders.Queries.GetOrdersList;
5 | using Ordering.Domain.Entities;
6 |
7 | namespace Ordering.Application.Mappings
8 | {
9 | public class MappingProfile : Profile
10 | {
11 | public MappingProfile()
12 | {
13 | CreateMap().ReverseMap();
14 | CreateMap().ReverseMap();
15 | CreateMap().ReverseMap();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.API/Program.cs:
--------------------------------------------------------------------------------
1 | using Discount.API.Extensions;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Hosting;
4 |
5 | namespace Discount.API
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | var host = CreateHostBuilder(args).Build();
12 | host.MigrateDatabase();
13 | host.Run();
14 | }
15 |
16 | public static IHostBuilder CreateHostBuilder(string[] args) =>
17 | Host.CreateDefaultBuilder(args)
18 | .ConfigureWebHostDefaults(webBuilder =>
19 | {
20 | webBuilder.UseStartup();
21 | });
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.API/Discount.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 | Linux
7 | ..\..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Entities/Product.cs:
--------------------------------------------------------------------------------
1 | using MongoDB.Bson;
2 | using MongoDB.Bson.Serialization.Attributes;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 |
8 | namespace Catalog.API.Entities
9 | {
10 | public class Product
11 | {
12 | [BsonId]
13 | [BsonRepresentation(BsonType.ObjectId)]
14 | public string Id { get; set; }
15 |
16 | [BsonElement("Name")]
17 | public string Name { get; set; }
18 | public string Category { get; set; }
19 | public string Summary { get; set; }
20 | public string Description { get; set; }
21 | public string ImageFile { get; set; }
22 | public decimal Price { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/docker-compose.dcproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2.1
5 | Linux
6 | 321974d8-9cf5-4853-8bb7-d66247e54bf2
7 | LaunchBrowser
8 | {Scheme}://localhost:{ServicePort}/swagger
9 | catalog.api
10 |
11 |
12 |
13 | docker-compose.yml
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Services/BasketService.cs:
--------------------------------------------------------------------------------
1 | using Shopping.Aggregator.Extensions;
2 | using Shopping.Aggregator.Models;
3 | using System;
4 | using System.Net.Http;
5 | using System.Threading.Tasks;
6 |
7 | namespace Shopping.Aggregator.Services
8 | {
9 | public class BasketService : IBasketService
10 | {
11 | private readonly HttpClient _client;
12 |
13 | public BasketService(HttpClient client)
14 | {
15 | _client = client ?? throw new ArgumentNullException(nameof(client));
16 | }
17 |
18 | public async Task GetBasket(string userName)
19 | {
20 | var response = await _client.GetAsync($"/api/v1/Basket/{userName}");
21 | return await response.ReadContentAs();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Extensions/HttpClientExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Text.Json;
4 | using System.Threading.Tasks;
5 |
6 | namespace Shopping.Aggregator.Extensions
7 | {
8 | public static class HttpClientExtensions
9 | {
10 | public static async Task ReadContentAs(this HttpResponseMessage response)
11 | {
12 | if (!response.IsSuccessStatusCode)
13 | throw new ApplicationException($"Something went wrong calling the API: {response.ReasonPhrase}");
14 |
15 | var dataAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
16 |
17 | return JsonSerializer.Deserialize(dataAsString, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ApiGateways/OcelotApiGw/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["ApiGateways/OcelotApiGw/OcelotApiGw.csproj", "ApiGateways/OcelotApiGw/"]
10 | RUN dotnet restore "ApiGateways/OcelotApiGw/OcelotApiGw.csproj"
11 | COPY . .
12 | WORKDIR "/src/ApiGateways/OcelotApiGw"
13 | RUN dotnet build "OcelotApiGw.csproj" -c Release -o /app/build
14 |
15 | FROM build AS publish
16 | RUN dotnet publish "OcelotApiGw.csproj" -c Release -o /app/publish
17 |
18 | FROM base AS final
19 | WORKDIR /app
20 | COPY --from=publish /app/publish .
21 | ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]
22 |
--------------------------------------------------------------------------------
/src/Services/Basket/Basket.API/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Basket.API
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Catalog.API
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Shopping.Aggregator
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["Services/Catalog/Catalog.API/Catalog.API.csproj", "Services/Catalog/Catalog.API/"]
10 | RUN dotnet restore "Services/Catalog/Catalog.API/Catalog.API.csproj"
11 | COPY . .
12 | WORKDIR "/src/Services/Catalog/Catalog.API"
13 | RUN dotnet build "Catalog.API.csproj" -c Release -o /app/build
14 |
15 | FROM build AS publish
16 | RUN dotnet publish "Catalog.API.csproj" -c Release -o /app/publish
17 |
18 | FROM base AS final
19 | WORKDIR /app
20 | COPY --from=publish /app/publish .
21 | ENTRYPOINT ["dotnet", "Catalog.API.dll"]
22 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.Grpc/Discount - Backup.Grpc.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 | EXPOSE 443
7 |
8 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
9 | WORKDIR /src
10 | COPY ["WebApps/AspnetRunBasics/AspnetRunBasics.csproj", "WebApps/AspnetRunBasics/"]
11 | RUN dotnet restore "WebApps/AspnetRunBasics/AspnetRunBasics.csproj"
12 | COPY . .
13 | WORKDIR "/src/WebApps/AspnetRunBasics"
14 | RUN dotnet build "AspnetRunBasics.csproj" -c Release -o /app/build
15 |
16 | FROM build AS publish
17 | RUN dotnet publish "AspnetRunBasics.csproj" -c Release -o /app/publish
18 |
19 | FROM base AS final
20 | WORKDIR /app
21 | COPY --from=publish /app/publish .
22 | ENTRYPOINT ["dotnet", "AspnetRunBasics.dll"]
23 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Services/OrderService.cs:
--------------------------------------------------------------------------------
1 | using AspnetRunBasics.Extensions;
2 | using AspnetRunBasics.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Net.Http;
6 | using System.Threading.Tasks;
7 |
8 | namespace AspnetRunBasics.Services
9 | {
10 | public class OrderService : IOrderService
11 | {
12 | private readonly HttpClient _client;
13 |
14 | public OrderService(HttpClient client)
15 | {
16 | _client = client ?? throw new ArgumentNullException(nameof(client));
17 | }
18 |
19 | public async Task> GetOrdersByUserName(string userName)
20 | {
21 | var response = await _client.GetAsync($"/Order/{userName}");
22 | return await response.ReadContentAs>();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.API/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["Services/Discount/Discount.API/Discount.API.csproj", "Services/Discount/Discount.API/"]
10 | RUN dotnet restore "Services/Discount/Discount.API/Discount.API.csproj"
11 | COPY . .
12 | WORKDIR "/src/Services/Discount/Discount.API"
13 | RUN dotnet build "Discount.API.csproj" -c Release -o /app/build
14 |
15 | FROM build AS publish
16 | RUN dotnet publish "Discount.API.csproj" -c Release -o /app/publish
17 |
18 | FROM base AS final
19 | WORKDIR /app
20 | COPY --from=publish /app/publish .
21 | ENTRYPOINT ["dotnet", "Discount.API.dll"]
22 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.Grpc/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["Services/Discount/Discount.Grpc/Discount.Grpc.csproj", "Services/Discount/Discount.Grpc/"]
10 | RUN dotnet restore "Services/Discount/Discount.Grpc/Discount.Grpc.csproj"
11 | COPY . .
12 | WORKDIR "/src/Services/Discount/Discount.Grpc"
13 | RUN dotnet build "Discount.Grpc.csproj" -c Release -o /app/build
14 |
15 | FROM build AS publish
16 | RUN dotnet publish "Discount.Grpc.csproj" -c Release -o /app/publish
17 |
18 | FROM base AS final
19 | WORKDIR /app
20 | COPY --from=publish /app/publish .
21 | ENTRYPOINT ["dotnet", "Discount.Grpc.dll"]
22 |
--------------------------------------------------------------------------------
/src/Services/Basket/Basket.API/Entities/ShoppingCart.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Basket.API.Entities
4 | {
5 | public class ShoppingCart
6 | {
7 | public string UserName { get; set; }
8 | public List Items { get; set; } = new List();
9 |
10 | public ShoppingCart()
11 | {
12 | }
13 |
14 | public ShoppingCart(string userName)
15 | {
16 | UserName = userName;
17 | }
18 |
19 | public decimal TotalPrice
20 | {
21 | get
22 | {
23 | decimal totalprice = 0;
24 | foreach (var item in Items)
25 | {
26 | totalprice += item.Price * item.Quantity;
27 | }
28 | return totalprice;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Services/Basket/Basket.API/Entities/BasketCheckout.cs:
--------------------------------------------------------------------------------
1 | namespace Basket.API.Entities
2 | {
3 | public class BasketCheckout
4 | {
5 | public string UserName { get; set; }
6 | public decimal TotalPrice { get; set; }
7 |
8 | // BillingAddress
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public string EmailAddress { get; set; }
12 | public string AddressLine { get; set; }
13 | public string Country { get; set; }
14 | public string State { get; set; }
15 | public string ZipCode { get; set; }
16 |
17 | // Payment
18 | public string CardName { get; set; }
19 | public string CardNumber { get; set; }
20 | public string Expiration { get; set; }
21 | public string CVV { get; set; }
22 | public int PaymentMethod { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj", "ApiGateways/Shopping.Aggregator/"]
10 | RUN dotnet restore "ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj"
11 | COPY . .
12 | WORKDIR "/src/ApiGateways/Shopping.Aggregator"
13 | RUN dotnet build "Shopping.Aggregator.csproj" -c Release -o /app/build
14 |
15 | FROM build AS publish
16 | RUN dotnet publish "Shopping.Aggregator.csproj" -c Release -o /app/publish
17 |
18 | FROM base AS final
19 | WORKDIR /app
20 | COPY --from=publish /app/publish .
21 | ENTRYPOINT ["dotnet", "Shopping.Aggregator.dll"]
22 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Models/BasketCheckoutModel.cs:
--------------------------------------------------------------------------------
1 | namespace AspnetRunBasics.Models
2 | {
3 | public class BasketCheckoutModel
4 | {
5 | public string UserName { get; set; }
6 | public decimal TotalPrice { get; set; }
7 |
8 | // BillingAddress
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public string EmailAddress { get; set; }
12 | public string AddressLine { get; set; }
13 | public string Country { get; set; }
14 | public string State { get; set; }
15 | public string ZipCode { get; set; }
16 |
17 | // Payment
18 | public string CardName { get; set; }
19 | public string CardNumber { get; set; }
20 | public string Expiration { get; set; }
21 | public string CVV { get; set; }
22 | public int PaymentMethod { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Models/OrderResponseModel.cs:
--------------------------------------------------------------------------------
1 | namespace AspnetRunBasics.Models
2 | {
3 | public class OrderResponseModel
4 | {
5 | public string UserName { get; set; }
6 | public decimal TotalPrice { get; set; }
7 |
8 | // BillingAddress
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public string EmailAddress { get; set; }
12 | public string AddressLine { get; set; }
13 | public string Country { get; set; }
14 | public string State { get; set; }
15 | public string ZipCode { get; set; }
16 |
17 | // Payment
18 | public string CardName { get; set; }
19 | public string CardNumber { get; set; }
20 | public string Expiration { get; set; }
21 | public string CVV { get; set; }
22 | public int PaymentMethod { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Services/OrderService.cs:
--------------------------------------------------------------------------------
1 | using Shopping.Aggregator.Extensions;
2 | using Shopping.Aggregator.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Net.Http;
7 | using System.Threading.Tasks;
8 |
9 | namespace Shopping.Aggregator.Services
10 | {
11 | public class OrderService : IOrderService
12 | {
13 | private readonly HttpClient _client;
14 |
15 | public OrderService(HttpClient client)
16 | {
17 | _client = client ?? throw new ArgumentNullException(nameof(client));
18 | }
19 |
20 | public async Task> GetOrdersByUserName(string userName)
21 | {
22 | var response = await _client.GetAsync($"/api/v1/Order/{userName}");
23 | return await response.ReadContentAs>();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/ApiGateways/Shopping.Aggregator/Models/OrderResponseModel.cs:
--------------------------------------------------------------------------------
1 | namespace Shopping.Aggregator.Models
2 | {
3 | public class OrderResponseModel
4 | {
5 | public string UserName { get; set; }
6 | public decimal TotalPrice { get; set; }
7 |
8 | // BillingAddress
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public string EmailAddress { get; set; }
12 | public string AddressLine { get; set; }
13 | public string Country { get; set; }
14 | public string State { get; set; }
15 | public string ZipCode { get; set; }
16 |
17 | // Payment
18 | public string CardName { get; set; }
19 | public string CardNumber { get; set; }
20 | public string Expiration { get; set; }
21 | public string CVV { get; set; }
22 | public int PaymentMethod { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.API/Ordering - Backup.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 |
7 |
8 |
9 |
10 | all
11 | runtime; build; native; contentfiles; analyzers; buildtransitive
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Ordering.Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/BuildingBlocks/EventBus.Messages/Events/BasketCheckoutEvent.cs:
--------------------------------------------------------------------------------
1 | namespace EventBus.Messages.Events
2 | {
3 | public class BasketCheckoutEvent : IntegrationBaseEvent
4 | {
5 | public string UserName { get; set; }
6 | public decimal TotalPrice { get; set; }
7 |
8 | // BillingAddress
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public string EmailAddress { get; set; }
12 | public string AddressLine { get; set; }
13 | public string Country { get; set; }
14 | public string State { get; set; }
15 | public string ZipCode { get; set; }
16 |
17 | // Payment
18 | public string CardName { get; set; }
19 | public string CardNumber { get; set; }
20 | public string Expiration { get; set; }
21 | public string CVV { get; set; }
22 | public int PaymentMethod { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Services/Basket/Basket.API/Dockerfile:
--------------------------------------------------------------------------------
1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2 |
3 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4 | WORKDIR /app
5 | EXPOSE 80
6 |
7 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
8 | WORKDIR /src
9 | COPY ["Services/Basket/Basket.API/Basket.API.csproj", "Services/Basket/Basket.API/"]
10 | COPY ["BuildingBlocks/EventBus.Messages/EventBus.Messages.csproj", "BuildingBlocks/EventBus.Messages/"]
11 | RUN dotnet restore "Services/Basket/Basket.API/Basket.API.csproj"
12 | COPY . .
13 | WORKDIR "/src/Services/Basket/Basket.API"
14 | RUN dotnet build "Basket.API.csproj" -c Release -o /app/build
15 |
16 | FROM build AS publish
17 | RUN dotnet publish "Basket.API.csproj" -c Release -o /app/publish
18 |
19 | FROM base AS final
20 | WORKDIR /app
21 | COPY --from=publish /app/publish .
22 | ENTRYPOINT ["dotnet", "Basket.API.dll"]
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Exceptions/ValidationException.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation.Results;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Ordering.Application.Exceptions
7 | {
8 | public class ValidationException : ApplicationException
9 | {
10 | public ValidationException()
11 | : base("One or more validation failures have occurred.")
12 | {
13 | Errors = new Dictionary();
14 | }
15 |
16 | public ValidationException(IEnumerable failures)
17 | : this()
18 | {
19 | Errors = failures
20 | .GroupBy(e => e.PropertyName, e => e.ErrorMessage)
21 | .ToDictionary(failureGroup => failureGroup.Key, failureGroup => failureGroup.ToArray());
22 | }
23 |
24 | public IDictionary Errors { get; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Catalog/Catalog.API/Data/CatalogContext.cs:
--------------------------------------------------------------------------------
1 | using Catalog.API.Entities;
2 | using Microsoft.Extensions.Configuration;
3 | using MongoDB.Driver;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 |
9 | namespace Catalog.API.Data
10 | {
11 | public class CatalogContext : ICatalogContext
12 | {
13 | public CatalogContext(IConfiguration configuration)
14 | {
15 | var client = new MongoClient(configuration.GetValue("DatabaseSettings:ConnectionString"));
16 | var database = client.GetDatabase(configuration.GetValue("DatabaseSettings:DatabaseName"));
17 |
18 | Products = database.GetCollection(configuration.GetValue("DatabaseSettings:CollectionName"));
19 | CatalogContextSeed.SeedData(Products);
20 | }
21 |
22 | public IMongoCollection Products { get; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Order.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using AspnetRunBasics.Models;
5 | using AspnetRunBasics.Services;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 |
9 | namespace AspnetRunBasics
10 | {
11 | public class OrderModel : PageModel
12 | {
13 | private readonly IOrderService _orderService;
14 |
15 | public OrderModel(IOrderService orderService)
16 | {
17 | _orderService = orderService ?? throw new ArgumentNullException(nameof(orderService));
18 | }
19 |
20 | public IEnumerable Orders { get; set; } = new List();
21 |
22 | public async Task OnGetAsync()
23 | {
24 | Orders = await _orderService.GetOrdersByUserName("swn");
25 |
26 | return Page();
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Services/Basket/Basket.API/GrpcServices/DiscountGrpcService.cs:
--------------------------------------------------------------------------------
1 | using Discount.Grpc.Protos;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace Basket.API.GrpcServices
8 | {
9 | public class DiscountGrpcService
10 | {
11 | private readonly DiscountProtoService.DiscountProtoServiceClient _discountProtoService;
12 |
13 | public DiscountGrpcService(DiscountProtoService.DiscountProtoServiceClient discountProtoService)
14 | {
15 | _discountProtoService = discountProtoService ?? throw new ArgumentNullException(nameof(discountProtoService));
16 | }
17 |
18 | public async Task GetDiscount(string productName)
19 | {
20 | var discountRequest = new GetDiscountRequest { ProductName = productName };
21 | return await _discountProtoService.GetDiscountAsync(discountRequest);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/ApplicationServiceRegistration.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 | using MediatR;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Ordering.Application.Behaviours;
5 | using System.Reflection;
6 |
7 | namespace Ordering.Application
8 | {
9 | public static class ApplicationServiceRegistration
10 | {
11 | public static IServiceCollection AddApplicationServices(this IServiceCollection services)
12 | {
13 | services.AddAutoMapper(Assembly.GetExecutingAssembly());
14 | services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
15 | services.AddMediatR(Assembly.GetExecutingAssembly());
16 |
17 | services.AddTransient(typeof(IPipelineBehavior<,>), typeof(UnhandledExceptionBehaviour<,>));
18 | services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehaviour<,>));
19 |
20 | return services;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.Grpc/Program.cs:
--------------------------------------------------------------------------------
1 | using Discount.Grpc.Extensions;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Hosting;
4 |
5 | namespace Discount.Grpc
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | var host = CreateHostBuilder(args).Build();
12 | host.MigrateDatabase();
13 | host.Run();
14 | }
15 |
16 | // Additional configuration is required to successfully run gRPC on macOS.
17 | // For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
18 | public static IHostBuilder CreateHostBuilder(string[] args) =>
19 | Host.CreateDefaultBuilder(args)
20 | .ConfigureWebHostDefaults(webBuilder =>
21 | {
22 | webBuilder.UseStartup();
23 | });
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Commands/UpdateOrder/UpdateOrderCommandValidator.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 |
3 | namespace Ordering.Application.Features.Orders.Commands.UpdateOrder
4 | {
5 | public class UpdateOrderCommandValidator : AbstractValidator
6 | {
7 | public UpdateOrderCommandValidator()
8 | {
9 | RuleFor(p => p.UserName)
10 | .NotEmpty().WithMessage("{UserName} is required.")
11 | .NotNull()
12 | .MaximumLength(50).WithMessage("{UserName} must not exceed 50 characters.");
13 |
14 | RuleFor(p => p.EmailAddress)
15 | .NotEmpty().WithMessage("{EmailAddress} is required.");
16 |
17 | RuleFor(p => p.TotalPrice)
18 | .NotEmpty().WithMessage("{TotalPrice} is required.")
19 | .GreaterThan(0).WithMessage("{TotalPrice} should be greater than zero.");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.Grpc/Protos/discount.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | option csharp_namespace = "Discount.Grpc.Protos";
4 |
5 | service DiscountProtoService {
6 | rpc GetDiscount (GetDiscountRequest) returns (CouponModel);
7 |
8 | rpc CreateDiscount (CreateDiscountRequest) returns (CouponModel);
9 | rpc UpdateDiscount (UpdateDiscountRequest) returns (CouponModel);
10 | rpc DeleteDiscount (DeleteDiscountRequest) returns (DeleteDiscountResponse);
11 | }
12 |
13 | message GetDiscountRequest {
14 | string productName = 1;
15 | }
16 |
17 | message CouponModel {
18 | int32 id = 1;
19 | string productName = 2;
20 | string description = 3;
21 | int32 amount = 4;
22 | }
23 |
24 | message CreateDiscountRequest {
25 | CouponModel coupon = 1;
26 | }
27 |
28 | message UpdateDiscountRequest {
29 | CouponModel coupon = 1;
30 | }
31 |
32 | message DeleteDiscountRequest {
33 | string productName = 1;
34 | }
35 |
36 | message DeleteDiscountResponse {
37 | bool success = 1;
38 | }
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace AspnetRunBasics.Pages
11 | {
12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13 | public class ErrorModel : PageModel
14 | {
15 | public string RequestId { get; set; }
16 |
17 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
18 |
19 | private readonly ILogger _logger;
20 |
21 | public ErrorModel(ILogger logger)
22 | {
23 | _logger = logger;
24 | }
25 |
26 | public void OnGet()
27 | {
28 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Ordering.Application.Contracts.Persistence;
3 | using Ordering.Domain.Entities;
4 | using Ordering.Infrastructure.Persistence;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Ordering.Infrastructure.Repositories
12 | {
13 | public class OrderRepository : RepositoryBase, IOrderRepository
14 | {
15 | public OrderRepository(OrderContext dbContext) : base(dbContext)
16 | {
17 | }
18 |
19 | public async Task> GetOrdersByUserName(string userName)
20 | {
21 | var orderList = await _dbContext.Orders
22 | .Where(o => o.UserName == userName)
23 | .ToListAsync();
24 | return orderList;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 |
Error.
8 |
An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID:@Model.RequestId
14 |
15 | }
16 |
17 |
Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Commands/CheckoutOrder/CheckoutOrderCommandValidator.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 |
3 | namespace Ordering.Application.Features.Orders.Commands.CheckoutOrder
4 | {
5 | public class CheckoutOrderCommandValidator : AbstractValidator
6 | {
7 | public CheckoutOrderCommandValidator()
8 | {
9 | RuleFor(p => p.UserName)
10 | .NotEmpty().WithMessage("{UserName} is required.")
11 | .NotNull()
12 | .MaximumLength(50).WithMessage("{UserName} must not exceed 50 characters.");
13 |
14 | RuleFor(p => p.EmailAddress)
15 | .NotEmpty().WithMessage("{EmailAddress} is required.");
16 |
17 | RuleFor(p => p.TotalPrice)
18 | .NotEmpty().WithMessage("{TotalPrice} is required.")
19 | .GreaterThan(0).WithMessage("{TotalPrice} should be greater than zero.");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/ApiGateways/OcelotApiGw/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:4938",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Local"
16 | }
17 | },
18 | "OcelotApiGw": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "dotnetRunMessages": "true",
25 | "applicationUrl": "http://localhost:5010"
26 | },
27 | "Docker": {
28 | "commandName": "Docker",
29 | "launchBrowser": true,
30 | "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
31 | "publishAllPorts": true
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Queries/GetOrdersList/OrdersVm.cs:
--------------------------------------------------------------------------------
1 | namespace Ordering.Application.Features.Orders.Queries.GetOrdersList
2 | {
3 | public class OrdersVm
4 | {
5 | public int Id { get; set; }
6 | public string UserName { get; set; }
7 | public decimal TotalPrice { get; set; }
8 |
9 | // BillingAddress
10 | public string FirstName { get; set; }
11 | public string LastName { get; set; }
12 | public string EmailAddress { get; set; }
13 | public string AddressLine { get; set; }
14 | public string Country { get; set; }
15 | public string State { get; set; }
16 | public string ZipCode { get; set; }
17 |
18 | // Payment
19 | public string CardName { get; set; }
20 | public string CardNumber { get; set; }
21 | public string Expiration { get; set; }
22 | public string CVV { get; set; }
23 | public int PaymentMethod { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:51063/",
7 | "sslPort": 44334
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "AspnetRunBasics": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5006"
25 | },
26 | "Docker": {
27 | "commandName": "Docker",
28 | "launchBrowser": true,
29 | "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
30 | "publishAllPorts": true,
31 | "useSSL": true
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Commands/CheckoutOrder/CheckoutOrderCommand.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Ordering.Application.Features.Orders.Commands.CheckoutOrder
4 | {
5 | public class CheckoutOrderCommand : IRequest
6 | {
7 | public string UserName { get; set; }
8 | public decimal TotalPrice { get; set; }
9 |
10 | // BillingAddress
11 | public string FirstName { get; set; }
12 | public string LastName { get; set; }
13 | public string EmailAddress { get; set; }
14 | public string AddressLine { get; set; }
15 | public string Country { get; set; }
16 | public string State { get; set; }
17 | public string ZipCode { get; set; }
18 |
19 | // Payment
20 | public string CardName { get; set; }
21 | public string CardNumber { get; set; }
22 | public string Expiration { get; set; }
23 | public string CVV { get; set; }
24 | public int PaymentMethod { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Application/Features/Orders/Commands/UpdateOrder/UpdateOrderCommand.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Ordering.Application.Features.Orders.Commands.UpdateOrder
4 | {
5 | public class UpdateOrderCommand : IRequest
6 | {
7 | public int Id { get; set; }
8 | public string UserName { get; set; }
9 | public decimal TotalPrice { get; set; }
10 |
11 | // BillingAddress
12 | public string FirstName { get; set; }
13 | public string LastName { get; set; }
14 | public string EmailAddress { get; set; }
15 | public string AddressLine { get; set; }
16 | public string Country { get; set; }
17 | public string State { get; set; }
18 | public string ZipCode { get; set; }
19 |
20 | // Payment
21 | public string CardName { get; set; }
22 | public string CardNumber { get; set; }
23 | public string Expiration { get; set; }
24 | public string CVV { get; set; }
25 | public int PaymentMethod { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Services/Discount/Discount.Grpc/Discount.Grpc.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | ..\..\..\docker-compose.dcproj
6 | Linux
7 | ..\..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/Services/Ordering/Ordering.Domain/Entities/Order.cs:
--------------------------------------------------------------------------------
1 | using Ordering.Domain.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Ordering.Domain.Entities
9 | {
10 | public class Order : EntityBase
11 | {
12 | public string UserName { get; set; }
13 | public decimal TotalPrice { get; set; }
14 |
15 | // BillingAddress
16 | public string FirstName { get; set; }
17 | public string LastName { get; set; }
18 | public string EmailAddress { get; set; }
19 | public string AddressLine { get; set; }
20 | public string Country { get; set; }
21 | public string State { get; set; }
22 | public string ZipCode { get; set; }
23 |
24 | // Payment
25 | public string CardName { get; set; }
26 | public string CardNumber { get; set; }
27 | public string Expiration { get; set; }
28 | public string CVV { get; set; }
29 | public int PaymentMethod { get; set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Mehmet Özkaya
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/WebApps/AspnetRunBasics/Pages/Shared/_TopProductPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model CatalogModel
2 |
3 |