diff --git a/AB-API.sln b/AB-API.sln index 66ac6c2..5d864d9 100644 --- a/AB-API.sln +++ b/AB-API.sln @@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AB-API", "AB-API\AB-API.csproj", "{45855EEB-EA31-476F-A020-1A3B71AD725A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AB.WEB", "AB-API\AB.WEB.csproj", "{45855EEB-EA31-476F-A020-1A3B71AD725A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AB.Domain", "AB.Domain\AB.Domain.csproj", "{9F60492C-A480-4056-983D-0F6B1A1ABD1B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AB.Services", "AB.Services\AB.Services.csproj", "{74E74C3E-8A8E-4771-894B-A2919B3422E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AB.Contracts", "AB.Contracts\AB.Contracts.csproj", "{9319695E-2237-49E2-80CD-761F53364421}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +21,18 @@ Global {45855EEB-EA31-476F-A020-1A3B71AD725A}.Debug|Any CPU.Build.0 = Debug|Any CPU {45855EEB-EA31-476F-A020-1A3B71AD725A}.Release|Any CPU.ActiveCfg = Release|Any CPU {45855EEB-EA31-476F-A020-1A3B71AD725A}.Release|Any CPU.Build.0 = Release|Any CPU + {9F60492C-A480-4056-983D-0F6B1A1ABD1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F60492C-A480-4056-983D-0F6B1A1ABD1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F60492C-A480-4056-983D-0F6B1A1ABD1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F60492C-A480-4056-983D-0F6B1A1ABD1B}.Release|Any CPU.Build.0 = Release|Any CPU + {74E74C3E-8A8E-4771-894B-A2919B3422E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74E74C3E-8A8E-4771-894B-A2919B3422E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74E74C3E-8A8E-4771-894B-A2919B3422E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74E74C3E-8A8E-4771-894B-A2919B3422E5}.Release|Any CPU.Build.0 = Release|Any CPU + {9319695E-2237-49E2-80CD-761F53364421}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9319695E-2237-49E2-80CD-761F53364421}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9319695E-2237-49E2-80CD-761F53364421}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9319695E-2237-49E2-80CD-761F53364421}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AB-API/AB-API.csproj b/AB-API/AB.WEB.csproj similarity index 100% rename from AB-API/AB-API.csproj rename to AB-API/AB.WEB.csproj diff --git a/AB-API/Program.cs b/AB-API/Program.cs index 48863a6..3450655 100644 --- a/AB-API/Program.cs +++ b/AB-API/Program.cs @@ -2,7 +2,7 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. -builder.Services.AddControllers(); +builder.Services.AddControllers().AddApplicationPart(typeof(AB.API.AssemblyReference).Assembly); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); diff --git a/AB.API/AB.API.csproj b/AB.API/AB.API.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.API/AB.API.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.API/AssemblyReference.cs b/AB.API/AssemblyReference.cs new file mode 100644 index 0000000..df0f9b2 --- /dev/null +++ b/AB.API/AssemblyReference.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.API +{ + public class AssemblyReference + { + } +} diff --git a/AB.API/Controllers/CustomerController.cs b/AB.API/Controllers/CustomerController.cs new file mode 100644 index 0000000..83438fc --- /dev/null +++ b/AB.API/Controllers/CustomerController.cs @@ -0,0 +1,53 @@ +using AB.Contracts; +using AB.Services.Abstractions; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.API.Controllers +{ + [ApiController] + [Route("api/customers")] + public class CustomerController : ControllerBase + { + + private readonly ICustomerService _customerService; + + + [HttpGet] + public async Task GetCustomers(CancellationToken cancellationToken) + { + var customers = await _customerService.GetAllAsync(cancellationToken); + + return Ok(customers); + } + + [HttpGet("{customerId:guid}")] + public async Task GetCustomerById(Guid customerId, CancellationToken cancellationToken) + { + var customer = await _customerService.GetByIdAsync(customerId, cancellationToken); + + return Ok(customer); + } + + [HttpPost] + public async Task CreateCustomer([FromBody] CustomerForCreationDto customerForCreation) + { + var customerDto = await _customerService.CreateAsync(customerForCreation); + + return CreatedAtAction(nameof(CreateCustomer), new {customerId = customerDto.Id}, customerDto); + } + + [HttpDelete("{customerId:guid}")] + public async Task DeleteCustomer(Guid customerId, CancellationToken cancellationToken) + { + await _customerService.DeleteAsync(customerId, cancellationToken); + + return NoContent(); + } + + } +} diff --git a/AB.Contracts/AB.Contracts.csproj b/AB.Contracts/AB.Contracts.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.Contracts/AB.Contracts.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.Contracts/CustomerDto.cs b/AB.Contracts/CustomerDto.cs new file mode 100644 index 0000000..a29e822 --- /dev/null +++ b/AB.Contracts/CustomerDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Contracts +{ + public class CustomerDto + { + + public Guid Id { get; set; } + + } +} diff --git a/AB.Contracts/CustomerForCreationDto.cs b/AB.Contracts/CustomerForCreationDto.cs new file mode 100644 index 0000000..c10ad58 --- /dev/null +++ b/AB.Contracts/CustomerForCreationDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Contracts +{ + public class CustomerForCreationDto + { + } +} diff --git a/AB.Contracts/SupplierForCreationDto.cs b/AB.Contracts/SupplierForCreationDto.cs new file mode 100644 index 0000000..46cb5e8 --- /dev/null +++ b/AB.Contracts/SupplierForCreationDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Contracts +{ + public class SupplierForCreationDto + { + } +} diff --git a/AB.Domain/AB.Domain.csproj b/AB.Domain/AB.Domain.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.Domain/AB.Domain.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.Domain/Entities/Customer.cs b/AB.Domain/Entities/Customer.cs new file mode 100644 index 0000000..3981bd5 --- /dev/null +++ b/AB.Domain/Entities/Customer.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Entities +{ + public class Customer + { + Guid coutomerId; + + } +} diff --git a/AB.Domain/Entities/Product.cs b/AB.Domain/Entities/Product.cs new file mode 100644 index 0000000..f4d68b0 --- /dev/null +++ b/AB.Domain/Entities/Product.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Entities +{ + public class Product + { + Guid productId; + + } +} diff --git a/AB.Domain/Entities/Supplier.cs b/AB.Domain/Entities/Supplier.cs new file mode 100644 index 0000000..6ef5a7e --- /dev/null +++ b/AB.Domain/Entities/Supplier.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Entities +{ + public class Supplier + { + + Guid supplierId; + } +} diff --git a/AB.Domain/Exceptions/BusinessPartnerNotFoundException.cs b/AB.Domain/Exceptions/BusinessPartnerNotFoundException.cs new file mode 100644 index 0000000..e19959e --- /dev/null +++ b/AB.Domain/Exceptions/BusinessPartnerNotFoundException.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Exceptions +{ + public class BusinessPartnerNotFoundException : NotFoundException + { + + public BusinessPartnerNotFoundException(Guid businessPartnerId) + : base ($"The BusinessPartner with the indetifier {businessPartnerId} was not found.") + { } + + } +} diff --git a/AB.Domain/Exceptions/NotFoundException.cs b/AB.Domain/Exceptions/NotFoundException.cs new file mode 100644 index 0000000..474d3cc --- /dev/null +++ b/AB.Domain/Exceptions/NotFoundException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Exceptions +{ + + [Serializable] + public abstract class NotFoundException : Exception + { + public NotFoundException() { } + public NotFoundException(string message) : base(message) { } + public NotFoundException(string message, Exception inner) : base(message, inner) { } + protected NotFoundException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + } +} diff --git a/AB.Domain/Repositories/ICustomerRepository.cs b/AB.Domain/Repositories/ICustomerRepository.cs new file mode 100644 index 0000000..1880083 --- /dev/null +++ b/AB.Domain/Repositories/ICustomerRepository.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Repositories +{ + public class ICustomerRepository + { + } +} diff --git a/AB.Domain/Repositories/ISupplierRepository.cs b/AB.Domain/Repositories/ISupplierRepository.cs new file mode 100644 index 0000000..a18dae7 --- /dev/null +++ b/AB.Domain/Repositories/ISupplierRepository.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Repositories +{ + public class ISupplierRepository + { + } +} diff --git a/AB.Domain/Repositories/IUnitOfWork.cs b/AB.Domain/Repositories/IUnitOfWork.cs new file mode 100644 index 0000000..201b165 --- /dev/null +++ b/AB.Domain/Repositories/IUnitOfWork.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Domain.Repositories +{ + public class IUnitOfWork + { + } +} diff --git a/AB.Persistence/AB.Persistence.csproj b/AB.Persistence/AB.Persistence.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.Persistence/AB.Persistence.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.Services.Abstractions/AB.Services.Abstractions.csproj b/AB.Services.Abstractions/AB.Services.Abstractions.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.Services.Abstractions/AB.Services.Abstractions.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.Services.Abstractions/ICustomerService.cs b/AB.Services.Abstractions/ICustomerService.cs new file mode 100644 index 0000000..ce49d1c --- /dev/null +++ b/AB.Services.Abstractions/ICustomerService.cs @@ -0,0 +1,17 @@ +using AB.Contracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Services.Abstractions +{ + public interface ICustomerService + { + Task CreateAsync(CustomerForCreationDto customerForCreation); + Task DeleteAsync(Guid customerId, CancellationToken cancellationToken); + Task> GetAllAsync(CancellationToken cancellationToken); + Task GetByIdAsync(Guid customerId, CancellationToken cancellationToken); + } +} diff --git a/AB.Services/AB.Services.csproj b/AB.Services/AB.Services.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/AB.Services/AB.Services.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/AB.Services/CustomerService.cs b/AB.Services/CustomerService.cs new file mode 100644 index 0000000..3bff851 --- /dev/null +++ b/AB.Services/CustomerService.cs @@ -0,0 +1,15 @@ +using AB.Contracts; +using AB.Services.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AB.Services +{ + internal class CustomerService : ICustomerService + { + + } +}