mirror of https://github.com/EasyAbp/EShop.git
committed by
GitHub
196 changed files with 6297 additions and 450 deletions
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs
0
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs
@ -1,30 +1,53 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Stores.StoreOwners; |
|||
using EasyAbp.EShop.Stores.StoreOwners.Dtos; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product |
|||
{ |
|||
public class IndexModel : ProductsPageModel |
|||
{ |
|||
private readonly IStoreAppService _storeAppService; |
|||
private readonly IStoreOwnerAppService _storeOwnerAppService; |
|||
|
|||
[BindProperty(SupportsGet = true)] |
|||
public Guid StoreId { get; set; } |
|||
|
|||
public Guid? StoreId { get; set; } |
|||
|
|||
[BindProperty(SupportsGet = true)] |
|||
public Guid? CategoryId { get; set; } |
|||
|
|||
|
|||
public string StoreName { get; set; } |
|||
|
|||
public IndexModel(IStoreAppService storeAppService) |
|||
|
|||
public IndexModel(IStoreAppService storeAppService, |
|||
IStoreOwnerAppService storeOwnerAppService) |
|||
{ |
|||
_storeAppService = storeAppService; |
|||
_storeOwnerAppService = storeOwnerAppService; |
|||
} |
|||
|
|||
|
|||
public virtual async Task OnGetAsync() |
|||
{ |
|||
StoreName = (await _storeAppService.GetAsync(StoreId)).Name; |
|||
//TODO: Need to handle: when StoreId is empty, and current user owns multiple store
|
|||
if (!StoreId.HasValue && CurrentUser.Id.HasValue) |
|||
{ |
|||
var storeOwners = await _storeOwnerAppService.GetListAsync(new GetStoreOwnerListDto |
|||
{ |
|||
OwnerUserId = CurrentUser.Id.Value, |
|||
}); |
|||
|
|||
StoreId = storeOwners.Items.FirstOrDefault()?.StoreId; |
|||
} |
|||
|
|||
if (!StoreId.HasValue) |
|||
{ |
|||
var defaultStore = await _storeAppService.GetDefaultAsync(); |
|||
StoreId = defaultStore.Id; |
|||
} |
|||
|
|||
StoreName = (await _storeAppService.GetAsync(StoreId.Value)).Name; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
|
|||
namespace EasyAbp.EShop.Stores.StoreOwners.Dtos |
|||
{ |
|||
public class CreateUpdateStoreOwnerDto : IMultiStore |
|||
{ |
|||
[Required] |
|||
public Guid StoreId { get; set; } |
|||
|
|||
[Required] |
|||
public Guid OwnerUserId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Stores.StoreOwners.Dtos |
|||
{ |
|||
public class GetStoreOwnerListDto : PagedAndSortedResultRequestDto |
|||
{ |
|||
public Guid? StoreId { get; set; } |
|||
|
|||
public Guid? OwnerUserId { get; set; } |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue