feat : create store and repository and interface
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Application.Aggregates.Stores;
|
||||
using Application.Aggregates.Stores.ViewModels;
|
||||
using Application.Aggregates.Users;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Server.Pages.Panel.Stores;
|
||||
|
||||
public class DeleteModel(StoresApplication storesApplication) : PageModel
|
||||
{
|
||||
[BindProperty]
|
||||
public StoreViewModel DeleteViewModel { get; set; } = new();
|
||||
|
||||
public async Task<IActionResult> OnGetAsync(Guid id)
|
||||
{
|
||||
if (id == Guid.Empty)
|
||||
{
|
||||
return RedirectToPage("Index");
|
||||
}
|
||||
|
||||
DeleteViewModel =
|
||||
await storesApplication.GetAsync(id);
|
||||
|
||||
if (DeleteViewModel == null)
|
||||
{
|
||||
return RedirectToPage("Index");
|
||||
}
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
{
|
||||
await storesApplication.DeleteAsync(DeleteViewModel.Id);
|
||||
|
||||
return RedirectToPage("Index");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user