First commit
This commit is contained in:
parent
7bb0c516f5
commit
9999d257e0
7
Project.Application/DTOs/Incoming/CreatingCategoryDto.cs
Normal file
7
Project.Application/DTOs/Incoming/CreatingCategoryDto.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Project.Application.DTOs.Incoming
|
||||||
|
{
|
||||||
|
public class CreatingCategoryDto
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Project.Application/DTOs/Incoming/CreatingProductDto.cs
Normal file
11
Project.Application/DTOs/Incoming/CreatingProductDto.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Application.DTOs.Incoming
|
||||||
|
{
|
||||||
|
public class CreatingProductDto
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
public CreatingCategoryDto? Category { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Project.Application/DTOs/Incoming/UpdatingCategoryDto.cs
Normal file
8
Project.Application/DTOs/Incoming/UpdatingCategoryDto.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Project.Application.DTOs.Incoming
|
||||||
|
{
|
||||||
|
public class UpdatingCategoryDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Project.Application/DTOs/Incoming/UpdatingProductDto.cs
Normal file
16
Project.Application/DTOs/Incoming/UpdatingProductDto.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Project.Application.DTOs.Incoming
|
||||||
|
{
|
||||||
|
public class UpdatingProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
public CreatingCategoryDto? Category { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Project.Application/DTOs/Outgoing/ReadingCategoryDto.cs
Normal file
8
Project.Application/DTOs/Outgoing/ReadingCategoryDto.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Project.Application.DTOs.Outgoing
|
||||||
|
{
|
||||||
|
public class ReadingCategoryDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Project.Application/DTOs/Outgoing/ReadingProductDto.cs
Normal file
10
Project.Application/DTOs/Outgoing/ReadingProductDto.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Project.Application.DTOs.Outgoing
|
||||||
|
{
|
||||||
|
public class ReadingProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
public ReadingCategoryDto? Category { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Project.Application/Interfaces/ICategoryService.cs
Normal file
27
Project.Application/Interfaces/ICategoryService.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.DTOs.Outgoing;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Application.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICategoryService
|
||||||
|
{
|
||||||
|
// CREATE
|
||||||
|
Task<Category?> AddCategoryAsync(CreatingCategoryDto creatingCategoryDto);
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
Task<IEnumerable<ReadingCategoryDto>> GetAllAsync();
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
Task<ReadingCategoryDto> GetByIdAsync(int id);
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
Task<ReadingCategoryDto> GetByNameAsync(string name);
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
Task<bool> UpdateCategoryAsync(UpdatingCategoryDto updatingCategoryDto);
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
Task<bool> DeleteCategoryAsync(int id);
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Project.Application/Interfaces/IProductService.cs
Normal file
27
Project.Application/Interfaces/IProductService.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.DTOs.Outgoing;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Application.Interfaces
|
||||||
|
{
|
||||||
|
public interface IProductService
|
||||||
|
{
|
||||||
|
//CREATE
|
||||||
|
Task<Product?> AddProductAsync(CreatingProductDto creatingProductDto);
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
Task<IEnumerable<ReadingProductDto>> GetAllAsync();
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
Task<ReadingProductDto> GetByIdAsync(int id);
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
Task<ReadingProductDto> GetByNameAsync(string name);
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
Task<bool> UpdateProductAsync(UpdatingProductDto updatingProductDto);
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
Task<bool> DeleteProductAsync(int id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.DTOs.Outgoing;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Application.MappingProfiles
|
||||||
|
{
|
||||||
|
public class BasicDtoMappingProfile : Profile
|
||||||
|
{
|
||||||
|
public BasicDtoMappingProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Category, CreatingCategoryDto>().ReverseMap();
|
||||||
|
CreateMap<Category, ReadingCategoryDto>().ReverseMap();
|
||||||
|
CreateMap<Category, UpdatingCategoryDto>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<Product, CreatingProductDto>().ReverseMap();
|
||||||
|
CreateMap<Product, ReadingProductDto>().ReverseMap();
|
||||||
|
CreateMap<Product, UpdatingProductDto>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Project.Application/Project.Application.csproj
Normal file
23
Project.Application/Project.Application.csproj
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Project.Domain\Project.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\Project.Infrastructure\Project.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
75
Project.Application/Services/CategoryService.cs
Normal file
75
Project.Application/Services/CategoryService.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.DTOs.Outgoing;
|
||||||
|
using Project.Application.Interfaces;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
using Project.Infrastructure.Interfaces;
|
||||||
|
|
||||||
|
namespace Project.Application.Services
|
||||||
|
{
|
||||||
|
public class CategoryService : ICategoryService
|
||||||
|
{
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly ICategoryRepository _categoryRepository;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public CategoryService(ICategoryRepository categoryService, IMapper mapper)
|
||||||
|
{
|
||||||
|
_categoryRepository = categoryService;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
public async Task<Category?> AddCategoryAsync(CreatingCategoryDto creatingCategoryDto)
|
||||||
|
{
|
||||||
|
var category = _mapper.Map<Category>(creatingCategoryDto);
|
||||||
|
var created = await _categoryRepository.AddAsync(category);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
public async Task<IEnumerable<ReadingCategoryDto>> GetAllAsync()
|
||||||
|
{
|
||||||
|
var categories = await _categoryRepository.GetAllAsync();
|
||||||
|
var readDto = _mapper.Map<IEnumerable<ReadingCategoryDto>>(categories);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
public async Task<ReadingCategoryDto> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
var category = await _categoryRepository.GetByIdAsync(id);
|
||||||
|
var readDto = _mapper.Map<ReadingCategoryDto>(category);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
public async Task<ReadingCategoryDto> GetByNameAsync(string name)
|
||||||
|
{
|
||||||
|
var category = await _categoryRepository.GetByNameAsync(name);
|
||||||
|
var readDto = _mapper.Map<ReadingCategoryDto>(category);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
public async Task<bool> UpdateCategoryAsync(UpdatingCategoryDto updatingCategoryDto)
|
||||||
|
{
|
||||||
|
var category = _mapper.Map<Category>(updatingCategoryDto);
|
||||||
|
bool isUpdated = await _categoryRepository.UpdateAsync(category);
|
||||||
|
return isUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
public async Task<bool> DeleteCategoryAsync(int id)
|
||||||
|
{
|
||||||
|
Category? category = await _categoryRepository.GetByIdAsync(id);
|
||||||
|
|
||||||
|
if (category is null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool isDeleted = await _categoryRepository.DeleteAsync(category);
|
||||||
|
return isDeleted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Project.Application/Services/ProductService.cs
Normal file
75
Project.Application/Services/ProductService.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.DTOs.Outgoing;
|
||||||
|
using Project.Application.Interfaces;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
using Project.Infrastructure.Interfaces;
|
||||||
|
|
||||||
|
namespace Project.Application.Services
|
||||||
|
{
|
||||||
|
public class ProductService : IProductService
|
||||||
|
{
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly IProductRepository _productRepository;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public ProductService(IProductRepository productRepository, IMapper mapper)
|
||||||
|
{
|
||||||
|
_productRepository = productRepository;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
public async Task<Product?> AddProductAsync(CreatingProductDto creatingProductDto)
|
||||||
|
{
|
||||||
|
var product = _mapper.Map<Product>(creatingProductDto);
|
||||||
|
var created = await _productRepository.AddAsync(product);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
public async Task<IEnumerable<ReadingProductDto>> GetAllAsync()
|
||||||
|
{
|
||||||
|
var products = await _productRepository.GetAllAsync();
|
||||||
|
var readDto = _mapper.Map<IEnumerable<ReadingProductDto>>(products);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
public async Task<ReadingProductDto> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
var product = await _productRepository.GetByIdAsync(id);
|
||||||
|
var readDto = _mapper.Map<ReadingProductDto>(product);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
public async Task<ReadingProductDto> GetByNameAsync(string name)
|
||||||
|
{
|
||||||
|
var product = await _productRepository.GetByNameAsync(name);
|
||||||
|
var readDto = _mapper.Map<ReadingProductDto>(product);
|
||||||
|
return readDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
public async Task<bool> UpdateProductAsync(UpdatingProductDto updatingProductDto)
|
||||||
|
{
|
||||||
|
var product = _mapper.Map<Product>(updatingProductDto);
|
||||||
|
bool idUpdated = await _productRepository.UpdateAsync(product);
|
||||||
|
return idUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
public async Task<bool> DeleteProductAsync(int id)
|
||||||
|
{
|
||||||
|
Product? product = await _productRepository.GetByIdAsync(id);
|
||||||
|
|
||||||
|
if (product is null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool isDeleted = await _productRepository.DeleteAsync(product);
|
||||||
|
return isDeleted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Project.Domain/Entities/Category.cs
Normal file
20
Project.Domain/Entities/Category.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Project.Domain.Entities
|
||||||
|
{
|
||||||
|
[Table("CATEGORY", Schema = "dbo")]
|
||||||
|
public class Category
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("ID")]
|
||||||
|
public int Id { get; set; } = 0;
|
||||||
|
[Required]
|
||||||
|
[Column("CATEGORY_NAME")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("CREATION_DATE", TypeName = "datetime")]
|
||||||
|
public DateTime CreationDate { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Project.Domain/Entities/CategoryRole.cs
Normal file
22
Project.Domain/Entities/CategoryRole.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Project.Domain.Entities
|
||||||
|
{
|
||||||
|
[Table("CATEGORY_ROLE", Schema = "dbo")]
|
||||||
|
public class CategoryRole
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CategoryId { get; set; }
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
[ForeignKey("CategoryId")]
|
||||||
|
[Required]
|
||||||
|
[Column("PRODUCT_CATEGORY")]
|
||||||
|
public Category? Category { get; set; }
|
||||||
|
[ForeignKey("RoleId")]
|
||||||
|
public Role? Role { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Project.Domain/Entities/Product.cs
Normal file
27
Project.Domain/Entities/Product.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Project.Domain.Entities
|
||||||
|
{
|
||||||
|
[Table("PRODUCT", Schema = "dbo")]
|
||||||
|
public class Product
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("ID")]
|
||||||
|
public int Id { get; set; } = 0;
|
||||||
|
[Required]
|
||||||
|
[Column("PRODUCT_NAME")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("PRICE", TypeName = "decimal(18,2)")]
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
public int CategoryId { get; set; }
|
||||||
|
[ForeignKey("CategoryId")]
|
||||||
|
[Column("PRODUCT_CATEGORY")]
|
||||||
|
public Category? Category { get; set; }
|
||||||
|
|
||||||
|
[Column("QUANTITY")]
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Project.Domain/Entities/Role.cs
Normal file
20
Project.Domain/Entities/Role.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Project.Domain.Entities
|
||||||
|
{
|
||||||
|
[Table("ROLE", Schema = "dbo")]
|
||||||
|
public class Role
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("ROLE")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("CREATION_DATE", TypeName = "datetime")]
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Project.Domain/Entities/User.cs
Normal file
27
Project.Domain/Entities/User.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Project.Domain.Entities
|
||||||
|
{
|
||||||
|
[Table("USER", Schema = "dbo")]
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("USER_NAME")]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("FIRST_NAME")]
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
[Required]
|
||||||
|
[Column("LAST_NAME")]
|
||||||
|
public string LastName { get; set; }
|
||||||
|
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
[ForeignKey("RoleId")]
|
||||||
|
public Role? Role { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Project.Domain/Project.Domain.csproj
Normal file
18
Project.Domain/Project.Domain.csproj
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
26
Project.Infrastructure/ApplicationDbContext.cs
Normal file
26
Project.Infrastructure/ApplicationDbContext.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Infrastructure
|
||||||
|
{
|
||||||
|
public class ApplicationDbContext : DbContext
|
||||||
|
{
|
||||||
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DbSet<User> Users { get; set; }
|
||||||
|
public DbSet<Role> Roles { get; set; }
|
||||||
|
public DbSet<Product> Products { get; set; }
|
||||||
|
public DbSet<Category> Categories { get; set; }
|
||||||
|
public DbSet<CategoryRole> CategoriesRoles { get; set; }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity<User>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Project.Infrastructure/Interfaces/ICategoryRepository.cs
Normal file
25
Project.Infrastructure/Interfaces/ICategoryRepository.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Infrastructure.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICategoryRepository
|
||||||
|
{
|
||||||
|
// CREATE
|
||||||
|
Task<Category?> AddAsync(Category category);
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
Task<IEnumerable<Category>> GetAllAsync();
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
Task<Category?> GetByIdAsync(int id);
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
Task<Category?> GetByNameAsync(string name);
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
Task<bool> UpdateAsync(Category category);
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
Task<bool> DeleteAsync(Category category);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Project.Infrastructure/Interfaces/IProductRepository.cs
Normal file
25
Project.Infrastructure/Interfaces/IProductRepository.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Project.Domain.Entities;
|
||||||
|
|
||||||
|
namespace Project.Infrastructure.Interfaces
|
||||||
|
{
|
||||||
|
public interface IProductRepository
|
||||||
|
{
|
||||||
|
// CREATE
|
||||||
|
Task<Product?> AddAsync(Product product);
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
Task<IEnumerable<Product>> GetAllAsync();
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
Task<Product?> GetByIdAsync(int id);
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
Task<Product?> GetByNameAsync(string name);
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
Task<bool> UpdateAsync(Product product);
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
Task<bool> DeleteAsync(Product product);
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Project.Infrastructure/Project.Infrastructure.csproj
Normal file
23
Project.Infrastructure/Project.Infrastructure.csproj
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Project.Domain\Project.Domain.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
63
Project.Infrastructure/Repositories/CategoryRepository.cs
Normal file
63
Project.Infrastructure/Repositories/CategoryRepository.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
using Project.Infrastructure.Interfaces;
|
||||||
|
|
||||||
|
namespace Project.Infrastructure.Repositories
|
||||||
|
{
|
||||||
|
public class CategoryRepository : ICategoryRepository
|
||||||
|
{
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly ApplicationDbContext _context;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public CategoryRepository(ApplicationDbContext context, IMapper mapper)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
public async Task<Category?> AddAsync(Category category)
|
||||||
|
{
|
||||||
|
await _context.Categories.AddAsync(category);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
public async Task<IEnumerable<Category>> GetAllAsync()
|
||||||
|
{
|
||||||
|
return await _context.Categories.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
public async Task<Category?> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
return await _context.Categories.FindAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
public async Task<Category?> GetByNameAsync(string name)
|
||||||
|
{
|
||||||
|
return await _context.Categories.FirstOrDefaultAsync(n => n.Name == name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
public async Task<bool> UpdateAsync(Category category)
|
||||||
|
{
|
||||||
|
_context.Entry(category).State = EntityState.Modified;
|
||||||
|
var results = await _context.SaveChangesAsync();
|
||||||
|
return results > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
public async Task<bool> DeleteAsync(Category category)
|
||||||
|
{
|
||||||
|
_context.Categories.Remove(category);
|
||||||
|
var result = await _context.SaveChangesAsync();
|
||||||
|
return result > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
64
Project.Infrastructure/Repositories/ProductRepository.cs
Normal file
64
Project.Infrastructure/Repositories/ProductRepository.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Project.Domain.Entities;
|
||||||
|
using Project.Infrastructure.Interfaces;
|
||||||
|
|
||||||
|
namespace Project.Infrastructure.Repositories
|
||||||
|
{
|
||||||
|
public class ProductRepository : IProductRepository
|
||||||
|
{
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly ApplicationDbContext _context;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public ProductRepository(ApplicationDbContext context, IMapper mapper)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
public async Task<Product?> AddAsync(Product product)
|
||||||
|
{
|
||||||
|
await _context.Products.AddAsync(product);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
[Authorize]
|
||||||
|
public async Task<IEnumerable<Product>> GetAllAsync()
|
||||||
|
{
|
||||||
|
return await _context.Products.Include(p => p.Category).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
public async Task<Product?> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
return await _context.Products.FindAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
public async Task<Product?> GetByNameAsync(string name)
|
||||||
|
{
|
||||||
|
return await _context.Products.FirstOrDefaultAsync(n => n.Name == name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
public async Task<bool> UpdateAsync(Product product)
|
||||||
|
{
|
||||||
|
_context.Entry(product).State = EntityState.Modified;
|
||||||
|
var results = await _context.SaveChangesAsync();
|
||||||
|
return results > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
public async Task<bool> DeleteAsync(Product product)
|
||||||
|
{
|
||||||
|
_context.Products.Remove(product);
|
||||||
|
var result = await _context.SaveChangesAsync();
|
||||||
|
return result > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
112
Project.Web/Controllers/CategoryController.cs
Normal file
112
Project.Web/Controllers/CategoryController.cs
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.Interfaces;
|
||||||
|
|
||||||
|
namespace Project.Web.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class CategoryController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly ICategoryService _categoryService;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public CategoryController(ICategoryService categoryService)
|
||||||
|
{
|
||||||
|
_categoryService = categoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
[HttpPost]
|
||||||
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<IActionResult> CreateCategory([FromBody] CreatingCategoryDto creatingCategoryDto)
|
||||||
|
{
|
||||||
|
var result = await _categoryService.AddCategoryAsync(creatingCategoryDto);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
var id = result.Id;
|
||||||
|
var createdResource = new { Id = id };
|
||||||
|
var actionName = nameof(GetCategoryById);
|
||||||
|
var routeValue = new { id = createdResource.Id };
|
||||||
|
return CreatedAtAction(actionName, routeValue, createdResource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BadRequest("geht nix");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
[HttpGet]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
public async Task<IActionResult> GetCategories()
|
||||||
|
{
|
||||||
|
var categories = await _categoryService.GetAllAsync();
|
||||||
|
return Ok(categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
[HttpGet("id/{id}", Name = "GetCategoryById")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<IActionResult> GetCategoryById(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Id");
|
||||||
|
}
|
||||||
|
var category = await _categoryService.GetByIdAsync(id);
|
||||||
|
if (category == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
return Ok(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
[HttpGet("name/{name}", Name = "GetCategoryByName")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<IActionResult> GetCategoryByName(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
return BadRequest("Name cannot be empty");
|
||||||
|
}
|
||||||
|
var category = await _categoryService.GetByNameAsync(name);
|
||||||
|
if (category == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
return Ok(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
[HttpPut("id/{id}", Name = "UpdateCategory")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<IActionResult> UpdateCategory(int id, UpdatingCategoryDto updatingCategoryDto)
|
||||||
|
{
|
||||||
|
var updated = await _categoryService.UpdateCategoryAsync(updatingCategoryDto);
|
||||||
|
return Ok(updated);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
[HttpDelete("id/{id}", Name = "DeleteCategory")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<IActionResult> DeleteCategory([FromRoute] int id)
|
||||||
|
{
|
||||||
|
await _categoryService.DeleteCategoryAsync(id);
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
124
Project.Web/Controllers/ProductController.cs
Normal file
124
Project.Web/Controllers/ProductController.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Project.Application.DTOs.Incoming;
|
||||||
|
using Project.Application.Interfaces;
|
||||||
|
using Project.Application.Services;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace Project.Web.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ProductController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
// FIELDS FOR CTOR
|
||||||
|
private readonly IProductService _productService;
|
||||||
|
|
||||||
|
// CTOR
|
||||||
|
public ProductController(IProductService productService)
|
||||||
|
{
|
||||||
|
_productService = productService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE
|
||||||
|
[HttpPost]
|
||||||
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<IActionResult> CreateProduct([FromBody] CreatingProductDto creatingProductDto) // with form body
|
||||||
|
{
|
||||||
|
var result = await _productService.AddProductAsync(creatingProductDto);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
var id = result.Id;
|
||||||
|
var createdResource = new { Id = id };
|
||||||
|
var actionName = nameof(GetProductById);
|
||||||
|
var routeValue = new { id = createdResource.Id };
|
||||||
|
return CreatedAtAction(actionName, routeValue, createdResource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BadRequest("geht nix");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ ALL
|
||||||
|
[Authorize(Roles ="Admin")]
|
||||||
|
[HttpGet]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
public async Task<IActionResult> GetProducts()
|
||||||
|
{
|
||||||
|
var products = await _productService.GetAllAsync();
|
||||||
|
return Ok(products);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> GetProducts()
|
||||||
|
{
|
||||||
|
var id = User.FindFirst(ClaimTypes.NameIdentifier);
|
||||||
|
|
||||||
|
var products = await _productService.getproductbyuserid(id);
|
||||||
|
return Ok(products);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY ID
|
||||||
|
[HttpGet("id/{id}", Name = "GetProductById")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<IActionResult> GetProductById(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Id");
|
||||||
|
}
|
||||||
|
var product = await _productService.GetByIdAsync(id);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
return Ok(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
// READ BY NAME
|
||||||
|
[HttpGet("name/{name}", Name = "GetProductByName")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<IActionResult> GetProductByName(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
return BadRequest("Name cannot be empty");
|
||||||
|
}
|
||||||
|
var product = await _productService.GetByNameAsync(name);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
return Ok(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
[HttpPut("id/{id}", Name = "UpdateProduct")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<IActionResult> UpdateProduct(int id, UpdatingProductDto updatingProductDto)
|
||||||
|
{
|
||||||
|
var updated = await _productService.UpdateProductAsync(updatingProductDto);
|
||||||
|
return Ok(updated);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
[HttpDelete("id/{id}", Name = "DeleteProduct")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<IActionResult> DeleteProduct([FromRoute] int id)
|
||||||
|
{
|
||||||
|
await _productService.DeleteProductAsync(id);
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
206
Project.Web/Migrations/20240619112737_Initial.Designer.cs
generated
Normal file
206
Project.Web/Migrations/20240619112737_Initial.Designer.cs
generated
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240619112737_Initial")]
|
||||||
|
partial class Initial
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<int>("Name")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
152
Project.Web/Migrations/20240619112737_Initial.cs
Normal file
152
Project.Web/Migrations/20240619112737_Initial.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Initial : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CATEGORY",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CATEGORY_NAME = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CREATION_DATE = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CATEGORY", x => x.ID);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ROLE",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ROLE = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CREATION_DATE = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ROLE", x => x.ID);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PRODUCT",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
PRODUCT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CREATION_DATE = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||||
|
CategoryId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
QUANTITY = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PRODUCT", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PRODUCT_CATEGORY_CategoryId",
|
||||||
|
column: x => x.CategoryId,
|
||||||
|
principalTable: "CATEGORY",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CATEGORY_ROLE",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CategoryId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
RoleId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CATEGORY_ROLE", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CATEGORY_ROLE_CATEGORY_CategoryId",
|
||||||
|
column: x => x.CategoryId,
|
||||||
|
principalTable: "CATEGORY",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CATEGORY_ROLE_ROLE_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalTable: "ROLE",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "USER",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
USER_NAME = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
FIRST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
LAST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
RoleId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_USER", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_USER_ROLE_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalTable: "ROLE",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CATEGORY_ROLE_CategoryId",
|
||||||
|
table: "CATEGORY_ROLE",
|
||||||
|
column: "CategoryId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CATEGORY_ROLE_RoleId",
|
||||||
|
table: "CATEGORY_ROLE",
|
||||||
|
column: "RoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PRODUCT_CategoryId",
|
||||||
|
table: "PRODUCT",
|
||||||
|
column: "CategoryId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_USER_RoleId",
|
||||||
|
table: "USER",
|
||||||
|
column: "RoleId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CATEGORY_ROLE");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PRODUCT");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "USER");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CATEGORY");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ROLE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
206
Project.Web/Migrations/20240625110321_zwote.Designer.cs
generated
Normal file
206
Project.Web/Migrations/20240625110321_zwote.Designer.cs
generated
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240625110321_zwote")]
|
||||||
|
partial class zwote
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<int>("Name")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("PRICE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
82
Project.Web/Migrations/20240625110321_zwote.cs
Normal file
82
Project.Web/Migrations/20240625110321_zwote.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class zwote : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.EnsureSchema(
|
||||||
|
name: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "USER",
|
||||||
|
newName: "USER",
|
||||||
|
newSchema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ROLE",
|
||||||
|
newName: "ROLE",
|
||||||
|
newSchema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "PRODUCT",
|
||||||
|
newName: "PRODUCT",
|
||||||
|
newSchema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CATEGORY_ROLE",
|
||||||
|
newName: "CATEGORY_ROLE",
|
||||||
|
newSchema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CATEGORY",
|
||||||
|
newName: "CATEGORY",
|
||||||
|
newSchema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "CREATION_DATE",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "PRODUCT",
|
||||||
|
newName: "PRICE");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "USER",
|
||||||
|
schema: "dbo",
|
||||||
|
newName: "USER");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ROLE",
|
||||||
|
schema: "dbo",
|
||||||
|
newName: "ROLE");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "PRODUCT",
|
||||||
|
schema: "dbo",
|
||||||
|
newName: "PRODUCT");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CATEGORY_ROLE",
|
||||||
|
schema: "dbo",
|
||||||
|
newName: "CATEGORY_ROLE");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CATEGORY",
|
||||||
|
schema: "dbo",
|
||||||
|
newName: "CATEGORY");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "PRICE",
|
||||||
|
table: "PRODUCT",
|
||||||
|
newName: "CREATION_DATE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
206
Project.Web/Migrations/20240625135651_dritte.Designer.cs
generated
Normal file
206
Project.Web/Migrations/20240625135651_dritte.Designer.cs
generated
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240625135651_dritte")]
|
||||||
|
partial class dritte
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<int>("Name")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("PRICE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Project.Web/Migrations/20240625135651_dritte.cs
Normal file
22
Project.Web/Migrations/20240625135651_dritte.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class dritte : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
207
Project.Web/Migrations/20240626064154_vierte.Designer.cs
generated
Normal file
207
Project.Web/Migrations/20240626064154_vierte.Designer.cs
generated
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240626064154_vierte")]
|
||||||
|
partial class vierte
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("PRICE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Project.Web/Migrations/20240626064154_vierte.cs
Normal file
36
Project.Web/Migrations/20240626064154_vierte.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class vierte : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "CATEGORY_NAME",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "CATEGORY",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "CATEGORY_NAME",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "CATEGORY",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
207
Project.Web/Migrations/20240627115130_fünfte.Designer.cs
generated
Normal file
207
Project.Web/Migrations/20240627115130_fünfte.Designer.cs
generated
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240627115130_fünfte")]
|
||||||
|
partial class fünfte
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("PRICE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Project.Web/Migrations/20240627115130_fünfte.cs
Normal file
22
Project.Web/Migrations/20240627115130_fünfte.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class fünfte : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
204
Project.Web/Migrations/ApplicationDbContextModelSnapshot.cs
Normal file
204
Project.Web/Migrations/ApplicationDbContextModelSnapshot.cs
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Project.Web.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("CATEGORY_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("CATEGORY_ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("PRODUCT_NAME");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("decimal(18,2)")
|
||||||
|
.HasColumnName("PRICE");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("QUANTITY");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("PRODUCT", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("CREATION_DATE");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("ROLE");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ROLE", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("ID");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("FIRST_NAME");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("LAST_NAME");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)")
|
||||||
|
.HasColumnName("USER_NAME");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("USER", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.CategoryRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Category", "Category")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Project.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Project.Domain.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Project.Web/Program.cs
Normal file
50
Project.Web/Program.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Project.Application.Interfaces;
|
||||||
|
using Project.Application.MappingProfiles;
|
||||||
|
using Project.Application.Services;
|
||||||
|
using Project.Infrastructure;
|
||||||
|
using Project.Infrastructure.Interfaces;
|
||||||
|
using Project.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
|
builder.Services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly);
|
||||||
|
|
||||||
|
builder.Services.AddScoped<IProductService, ProductService>();
|
||||||
|
builder.Services.AddScoped<IProductRepository, ProductRepository>();
|
||||||
|
|
||||||
|
builder.Services.AddScoped<ICategoryService, CategoryService>();
|
||||||
|
builder.Services.AddScoped<ICategoryRepository, CategoryRepository>();
|
||||||
|
|
||||||
|
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
|
{
|
||||||
|
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Project.Web"));
|
||||||
|
});
|
||||||
|
builder.Services.AddMemoryCache();
|
||||||
|
|
||||||
|
builder.Logging.ClearProviders();
|
||||||
|
builder.Logging.AddConsole();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
25
Project.Web/Project.Web.csproj
Normal file
25
Project.Web/Project.Web.csproj
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Project.Application\Project.Application.csproj" />
|
||||||
|
<ProjectReference Include="..\Project.Domain\Project.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\Project.Infrastructure\Project.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
8
Project.Web/Project.Web.csproj.user
Normal file
8
Project.Web/Project.Web.csproj.user
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||||
|
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||||
|
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
6
Project.Web/Project.http
Normal file
6
Project.Web/Project.http
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@Project_HostAddress = http://localhost:5035
|
||||||
|
|
||||||
|
GET {{Project_HostAddress}}/weatherforecast/
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
###
|
||||||
41
Project.Web/Properties/launchSettings.json
Normal file
41
Project.Web/Properties/launchSettings.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:28621",
|
||||||
|
"sslPort": 44313
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"applicationUrl": "http://localhost:5035",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"applicationUrl": "https://localhost:7274;http://localhost:5035",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Project.Web/appsettings.Development.json
Normal file
8
Project.Web/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Project.Web/appsettings.json
Normal file
12
Project.Web/appsettings.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=Proje;Trusted_Connection=true;TrustServerCertificate=true;"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
43
Project.sln
Normal file
43
Project.sln
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.10.34916.146
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Project.Domain", "Project.Domain\Project.Domain.csproj", "{DDF5C1C7-C621-4927-AF0F-85ED0E278006}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Project.Infrastructure", "Project.Infrastructure\Project.Infrastructure.csproj", "{EECBA4CC-4B15-4CF2-880A-0BEAEFE892E0}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Project.Application", "Project.Application\Project.Application.csproj", "{E4D384D6-EE13-492B-99CA-57B0C31D6B2E}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Project.Web", "Project.Web\Project.Web.csproj", "{4979AFF9-A038-49C4-9617-D0FF12E91AF2}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{DDF5C1C7-C621-4927-AF0F-85ED0E278006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{DDF5C1C7-C621-4927-AF0F-85ED0E278006}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{DDF5C1C7-C621-4927-AF0F-85ED0E278006}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{DDF5C1C7-C621-4927-AF0F-85ED0E278006}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EECBA4CC-4B15-4CF2-880A-0BEAEFE892E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EECBA4CC-4B15-4CF2-880A-0BEAEFE892E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EECBA4CC-4B15-4CF2-880A-0BEAEFE892E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EECBA4CC-4B15-4CF2-880A-0BEAEFE892E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E4D384D6-EE13-492B-99CA-57B0C31D6B2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E4D384D6-EE13-492B-99CA-57B0C31D6B2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E4D384D6-EE13-492B-99CA-57B0C31D6B2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E4D384D6-EE13-492B-99CA-57B0C31D6B2E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4979AFF9-A038-49C4-9617-D0FF12E91AF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4979AFF9-A038-49C4-9617-D0FF12E91AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4979AFF9-A038-49C4-9617-D0FF12E91AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4979AFF9-A038-49C4-9617-D0FF12E91AF2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {371AE6F0-9591-4D9D-BC1A-4CEE4E481C41}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
Loading…
x
Reference in New Issue
Block a user