Merge pull request 'feat:Category' (#4) from feat/Category into main
Reviewed-on: #4 Reviewed-by: SajjadDoosty <sajjad.doosty.83@gmail.com>
This commit is contained in:
@ -0,0 +1,94 @@
|
|||||||
|
using Application.Aggregates.Categorys.ViewModels;
|
||||||
|
using Domain.Aggregates.Categorys;
|
||||||
|
using Domain.Aggregates.Categorys.Data;
|
||||||
|
using Mapster;
|
||||||
|
using Resources.Messages;
|
||||||
|
|
||||||
|
namespace Application.Aggregates.Categorys;
|
||||||
|
|
||||||
|
public class CategorysApplication(ICategoryRepository categoryRepository)
|
||||||
|
{
|
||||||
|
public async Task<CategoryViewModel> CreateAsync(CreateCategoryViewModel categoryViewModel)
|
||||||
|
{
|
||||||
|
var category = Category.Create(
|
||||||
|
name: categoryViewModel.Name,
|
||||||
|
description: categoryViewModel.Description);
|
||||||
|
|
||||||
|
|
||||||
|
if (categoryViewModel.IsActive == true)
|
||||||
|
{
|
||||||
|
category.Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
await categoryRepository.AddAsync(category);
|
||||||
|
await categoryRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return category.Adapt<CategoryViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<CategoryViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
var category =
|
||||||
|
await categoryRepository.GetAllAsync();
|
||||||
|
|
||||||
|
return category.Adapt<List<CategoryViewModel>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CategoryViewModel> GetAsync(Guid categoryId)
|
||||||
|
{
|
||||||
|
var category =
|
||||||
|
await categoryRepository.GetAsync(categoryId);
|
||||||
|
|
||||||
|
return category.Adapt<CategoryViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CategoryViewModel> UpdateAsync(UpdateCategoryViewModel updateCategoryView)
|
||||||
|
{
|
||||||
|
var update =
|
||||||
|
await categoryRepository.GetAsync(updateCategoryView.Id);
|
||||||
|
|
||||||
|
if (update == null || updateCategoryView.Id == Guid.Empty)
|
||||||
|
{
|
||||||
|
var error =
|
||||||
|
string.Format(Errors.NotFound, Resources.DataDictionary.Store);
|
||||||
|
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
update.Update(
|
||||||
|
name: updateCategoryView.Name,
|
||||||
|
description: updateCategoryView.Description);
|
||||||
|
|
||||||
|
|
||||||
|
if (updateCategoryView.IsActive == true)
|
||||||
|
{
|
||||||
|
update.Activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
update.Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
await categoryRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return update.Adapt<CategoryViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteAsync(Guid categoryId)
|
||||||
|
{
|
||||||
|
var delete =
|
||||||
|
await categoryRepository.GetAsync(categoryId);
|
||||||
|
|
||||||
|
if (delete == null || delete.Id == Guid.Empty)
|
||||||
|
{
|
||||||
|
var error =
|
||||||
|
string.Format(Errors.NotFound, Resources.DataDictionary.Store);
|
||||||
|
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
categoryRepository.Remove(delete);
|
||||||
|
|
||||||
|
await categoryRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
namespace Application.Aggregates.Categorys.ViewModels;
|
||||||
|
|
||||||
|
public class CategoryViewModel : UpdateCategoryViewModel
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
namespace Application.Aggregates.Categorys.ViewModels;
|
||||||
|
|
||||||
|
public class CreateCategoryViewModel
|
||||||
|
{
|
||||||
|
public CreateCategoryViewModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
namespace Application.Aggregates.Categorys.ViewModels;
|
||||||
|
|
||||||
|
public class UpdateCategoryViewModel : CreateCategoryViewModel
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
}
|
||||||
46
src/Core/Domain/Aggregates/Categorys/Category.cs
Normal file
46
src/Core/Domain/Aggregates/Categorys/Category.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using Domain.Aggregates.Categorys;
|
||||||
|
using Domain.SeedWork;
|
||||||
|
using Framework.DataType;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Domain.Aggregates.Categorys
|
||||||
|
{
|
||||||
|
public class Category : Entity
|
||||||
|
{
|
||||||
|
public Category()
|
||||||
|
{
|
||||||
|
////**********
|
||||||
|
}
|
||||||
|
|
||||||
|
private Category(string name,string description)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public static Category Create(string name,string description)
|
||||||
|
{
|
||||||
|
var category = new Category(
|
||||||
|
name: name.Fix() ?? "",
|
||||||
|
description: description.Fix() ?? "");
|
||||||
|
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(string name, string description)
|
||||||
|
{
|
||||||
|
Name = name.Fix() ?? "";
|
||||||
|
Description = description.Fix() ?? "";
|
||||||
|
|
||||||
|
|
||||||
|
SetUpdateDateTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
namespace Domain.Aggregates.Categorys.Data;
|
||||||
|
|
||||||
|
public interface ICategoryRepository
|
||||||
|
{
|
||||||
|
Task AddAsync(Category category);
|
||||||
|
Task<List<Category>> GetAllAsync();
|
||||||
|
Task<Category?> GetAsync(Guid categoryId);
|
||||||
|
void Remove(Category category);
|
||||||
|
Task SaveChangesAsync();
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
using Domain.Aggregates.Users;
|
using Domain.Aggregates.Users;
|
||||||
using Domain.Aggregates.Products;
|
using Domain.Aggregates.Products;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Domain.Aggregates.Categorys;
|
||||||
|
|
||||||
namespace Persistence;
|
namespace Persistence;
|
||||||
|
|
||||||
@ -16,5 +17,6 @@ public class DatabaseContext: DbContext
|
|||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
public DbSet<Store> Stores { get; set; }
|
public DbSet<Store> Stores { get; set; }
|
||||||
public DbSet<Product> Products { get; set; }
|
public DbSet<Product> Products { get; set; }
|
||||||
|
public DbSet<Category> Category { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
using Domain.Aggregates.Categorys;
|
||||||
|
using Domain.Aggregates.Categorys.Data;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Persistence.Repositories.Aggregates.Categorys;
|
||||||
|
|
||||||
|
public class CategoryRepository(DatabaseContext databaseContext) : ICategoryRepository
|
||||||
|
{
|
||||||
|
public async Task AddAsync(Category categorys)
|
||||||
|
{
|
||||||
|
await databaseContext.AddAsync(categorys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<Category>> GetAllAsync()
|
||||||
|
{
|
||||||
|
var category =
|
||||||
|
await databaseContext.Category
|
||||||
|
.Where(x => x.IsDeleted == false)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Category?> GetAsync(Guid categoryId)
|
||||||
|
{
|
||||||
|
var category =
|
||||||
|
await databaseContext.Category
|
||||||
|
.Where(x => x.IsDeleted == false)
|
||||||
|
.Where(x => x.Id == categoryId)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Remove(Category category)
|
||||||
|
{
|
||||||
|
category.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SaveChangesAsync()
|
||||||
|
{
|
||||||
|
await databaseContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -9,4 +9,5 @@
|
|||||||
<a class="btn btn-secondary my-2" asp-page="Panel/Users/Index">[ Users ]</a>
|
<a class="btn btn-secondary my-2" asp-page="Panel/Users/Index">[ Users ]</a>
|
||||||
<a class="btn btn-secondary my-2" asp-page="Panel/Stores/Index">[ Stores ]</a>
|
<a class="btn btn-secondary my-2" asp-page="Panel/Stores/Index">[ Stores ]</a>
|
||||||
<a class="btn btn-secondary my-2" asp-page="Panel/Products/Index">[ Products ]</a>
|
<a class="btn btn-secondary my-2" asp-page="Panel/Products/Index">[ Products ]</a>
|
||||||
|
<a class="btn btn-secondary my-2" asp-page="Panel/Category/Index">[ Category ]</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
37
src/Presentation/Server/Pages/Panel/Category/Create.cshtml
Normal file
37
src/Presentation/Server/Pages/Panel/Category/Create.cshtml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
@page
|
||||||
|
@model Server.Pages.Panel.Category.CreateModel
|
||||||
|
@{
|
||||||
|
var pageTitle =
|
||||||
|
$"{Resources.DataDictionary.CreateOf} {Resources.DataDictionary.Category}";
|
||||||
|
|
||||||
|
ViewData[Constants.ViewDataKeyName.PageTitle] = pageTitle;
|
||||||
|
}
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<section-form>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
|
||||||
|
<section-form-header>
|
||||||
|
@(pageTitle)
|
||||||
|
</section-form-header>
|
||||||
|
|
||||||
|
<partial name="PartialViews/_DisplayPageMessages" />
|
||||||
|
|
||||||
|
|
||||||
|
<ub-full-input asp-for="categoryViewModel.Name" />
|
||||||
|
|
||||||
|
<ub-full-input asp-for="categoryViewModel.Description" />
|
||||||
|
|
||||||
|
<ub-full-checkbox asp-for="categoryViewModel.IsActive" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<section-form-buttons>
|
||||||
|
<button-create />
|
||||||
|
<button-reset />
|
||||||
|
</section-form-buttons>
|
||||||
|
|
||||||
|
</section-form>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using Application.Aggregates.Categorys;
|
||||||
|
using Application.Aggregates.Categorys.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace Server.Pages.Panel.Category;
|
||||||
|
|
||||||
|
public class CreateModel(CategorysApplication categorysApplication) : PageModel
|
||||||
|
{
|
||||||
|
[BindProperty]
|
||||||
|
public CreateCategoryViewModel categoryViewModel { get; set; }
|
||||||
|
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> OnPostAsync()
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
await categorysApplication.CreateAsync(categoryViewModel);
|
||||||
|
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
37
src/Presentation/Server/Pages/Panel/Category/Delete.cshtml
Normal file
37
src/Presentation/Server/Pages/Panel/Category/Delete.cshtml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
@page
|
||||||
|
@model Server.Pages.Panel.Category.DeleteModel
|
||||||
|
@{
|
||||||
|
var pageTitle =
|
||||||
|
$"{Resources.DataDictionary.CreateOf} {Resources.DataDictionary.Category}";
|
||||||
|
|
||||||
|
ViewData[Constants.ViewDataKeyName.PageTitle] = pageTitle;
|
||||||
|
}
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<section-form>
|
||||||
|
|
||||||
|
<input hidden asp-for="DeleteViewModel.Id" dir="ltr" />
|
||||||
|
|
||||||
|
<fieldset disabled>
|
||||||
|
|
||||||
|
<section-form-header>
|
||||||
|
@(pageTitle)
|
||||||
|
</section-form-header>
|
||||||
|
|
||||||
|
<partial name="PartialViews/_DisplayPageMessages" />
|
||||||
|
|
||||||
|
<ub-full-input asp-for="DeleteViewModel.Name" />
|
||||||
|
|
||||||
|
<ub-full-input asp-for="DeleteViewModel.Description" />
|
||||||
|
|
||||||
|
<ub-full-checkbox asp-for="DeleteViewModel.IsActive" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<section-form-buttons>
|
||||||
|
<button-delete />
|
||||||
|
</section-form-buttons>
|
||||||
|
|
||||||
|
</section-form>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
using Application.Aggregates.Categorys;
|
||||||
|
using Application.Aggregates.Categorys.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace Server.Pages.Panel.Category;
|
||||||
|
|
||||||
|
public class DeleteModel(CategorysApplication categorysApplication) : PageModel
|
||||||
|
{
|
||||||
|
[BindProperty]
|
||||||
|
public CategoryViewModel DeleteViewModel { get; set; } = new();
|
||||||
|
|
||||||
|
public async Task<IActionResult> OnGetAsync(Guid id)
|
||||||
|
{
|
||||||
|
if (id == Guid.Empty)
|
||||||
|
{
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteViewModel =
|
||||||
|
await categorysApplication.GetAsync(id);
|
||||||
|
|
||||||
|
if (DeleteViewModel == null)
|
||||||
|
{
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> OnPostAsync()
|
||||||
|
{
|
||||||
|
await categorysApplication.DeleteAsync(DeleteViewModel.Id);
|
||||||
|
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
33
src/Presentation/Server/Pages/Panel/Category/Index.cshtml
Normal file
33
src/Presentation/Server/Pages/Panel/Category/Index.cshtml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
@page
|
||||||
|
@model Server.Pages.Panel.Category.IndexModel
|
||||||
|
@{
|
||||||
|
}
|
||||||
|
<div class="my-2 float-end">
|
||||||
|
<a class="btn btn-primary" asp-page="Create">@(Resources.ButtonCaptions.Create)</a>
|
||||||
|
</div>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@(Html.Ub_DisplayStringWithTh(Resources.DataDictionary.Name))
|
||||||
|
@(Html.Ub_DisplayStringWithTh(Resources.DataDictionary.Description))
|
||||||
|
@(Html.Ub_DisplayStringWithTh(Resources.DataDictionary.IsActive))
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.category)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
@(Html.Ub_DisplayStringWithTd(item.Name))
|
||||||
|
@(Html.Ub_DisplayStringWithTd(item.Description))
|
||||||
|
@(Html.Ub_DisplayBooleanWithTd(item.IsActive))
|
||||||
|
<td>
|
||||||
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
<a asp-page="Update" asp-route-Id="@(item.Id)" class="btn btn-warning">@(Resources.ButtonCaptions.Edit)</a>
|
||||||
|
<a asp-page="Delete" asp-route-Id="@(item.Id)" class="btn btn-danger">@(Resources.ButtonCaptions.Delete)</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
15
src/Presentation/Server/Pages/Panel/Category/Index.cshtml.cs
Normal file
15
src/Presentation/Server/Pages/Panel/Category/Index.cshtml.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Application.Aggregates.Categorys;
|
||||||
|
using Application.Aggregates.Categorys.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace Server.Pages.Panel.Category;
|
||||||
|
|
||||||
|
public class IndexModel(CategorysApplication categorysApplication) : PageModel
|
||||||
|
{
|
||||||
|
public List<CategoryViewModel> category { get; set; } = new();
|
||||||
|
|
||||||
|
public async Task OnGetAsync()
|
||||||
|
{
|
||||||
|
category = await categorysApplication.GetAllAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/Presentation/Server/Pages/Panel/Category/Update.cshtml
Normal file
38
src/Presentation/Server/Pages/Panel/Category/Update.cshtml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@page
|
||||||
|
@model Server.Pages.Panel.Category.UpdateModel
|
||||||
|
@{
|
||||||
|
var pageTitle =
|
||||||
|
$"{Resources.DataDictionary.CreateOf} {Resources.DataDictionary.Category}";
|
||||||
|
|
||||||
|
ViewData[Constants.ViewDataKeyName.PageTitle] = pageTitle;
|
||||||
|
}
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<section-form>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
|
||||||
|
<section-form-header>
|
||||||
|
@(pageTitle)
|
||||||
|
</section-form-header>
|
||||||
|
|
||||||
|
<partial name="PartialViews/_DisplayPageMessages" />
|
||||||
|
|
||||||
|
<input hidden asp-for="UpdateViewModel.Id" />
|
||||||
|
|
||||||
|
<ub-full-input asp-for="UpdateViewModel.Name" />
|
||||||
|
|
||||||
|
<ub-full-input asp-for="UpdateViewModel.Description" />
|
||||||
|
|
||||||
|
<ub-full-checkbox asp-for="UpdateViewModel.IsActive" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<section-form-buttons>
|
||||||
|
<button-save />
|
||||||
|
<button-reset />
|
||||||
|
</section-form-buttons>
|
||||||
|
|
||||||
|
</section-form>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
using Application.Aggregates.Categorys;
|
||||||
|
using Application.Aggregates.Categorys.ViewModels;
|
||||||
|
using Application.Aggregates.Products;
|
||||||
|
using Application.Aggregates.Products.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace Server.Pages.Panel.Category;
|
||||||
|
|
||||||
|
public class UpdateModel(CategorysApplication categorysApplication) : PageModel
|
||||||
|
{
|
||||||
|
[BindProperty]
|
||||||
|
public CategoryViewModel UpdateViewModel { get; set; }
|
||||||
|
|
||||||
|
public async Task<IActionResult> OnGetAsync(Guid id)
|
||||||
|
{
|
||||||
|
if (id == Guid.Empty)
|
||||||
|
{
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateViewModel =
|
||||||
|
await categorysApplication.GetAsync(id);
|
||||||
|
|
||||||
|
if (UpdateViewModel == null)
|
||||||
|
{
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> OnPostAsync()
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
await categorysApplication.UpdateAsync(UpdateViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToPage("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,11 +1,14 @@
|
|||||||
|
using Application.Aggregates.Categorys;
|
||||||
using Application.Aggregates.Products;
|
using Application.Aggregates.Products;
|
||||||
using Application.Aggregates.Stores;
|
using Application.Aggregates.Stores;
|
||||||
using Application.Aggregates.Users;
|
using Application.Aggregates.Users;
|
||||||
|
using Domain.Aggregates.Categorys.Data;
|
||||||
using Domain.Aggregates.Products.Data;
|
using Domain.Aggregates.Products.Data;
|
||||||
using Domain.Aggregates.Stores.Data;
|
using Domain.Aggregates.Stores.Data;
|
||||||
using Domain.Aggregates.Users.Data;
|
using Domain.Aggregates.Users.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Persistence;
|
using Persistence;
|
||||||
|
using Persistence.Repositories.Aggregates.Categorys;
|
||||||
using Persistence.Repositories.Aggregates.Products;
|
using Persistence.Repositories.Aggregates.Products;
|
||||||
using Persistence.Repositories.Aggregates.Stores;
|
using Persistence.Repositories.Aggregates.Stores;
|
||||||
using Persistence.Repositories.Aggregates.Users;
|
using Persistence.Repositories.Aggregates.Users;
|
||||||
@ -40,6 +43,9 @@ public class Program
|
|||||||
builder.Services.AddScoped<IProductRepository, ProductRepository>();
|
builder.Services.AddScoped<IProductRepository, ProductRepository>();
|
||||||
builder.Services.AddScoped<ProductsApplication>();
|
builder.Services.AddScoped<ProductsApplication>();
|
||||||
|
|
||||||
|
builder.Services.AddScoped<ICategoryRepository, CategoryRepository>();
|
||||||
|
builder.Services.AddScoped<CategorysApplication>();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
|
|||||||
Reference in New Issue
Block a user