mirror of https://github.com/EasyAbp/EShop.git
26 changed files with 10459 additions and 17 deletions
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.Categories |
|||
{ |
|||
public class CategoryManager : DomainService, ICategoryManager |
|||
{ |
|||
private readonly ICategoryRepository _repository; |
|||
|
|||
public CategoryManager(ICategoryRepository repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
public virtual async Task<Category> CreateAsync(Guid? parentId, string uniqueName, string displayName, |
|||
string description, string mediaResources, bool isHidden) |
|||
{ |
|||
if (await _repository.AnyAsync(x => x.UniqueName == uniqueName)) |
|||
{ |
|||
throw new DuplicateCategoryUniqueNameException(); |
|||
} |
|||
|
|||
return new Category(GuidGenerator.Create(), CurrentTenant.Id, parentId, uniqueName, displayName, |
|||
description, mediaResources, isHidden); |
|||
} |
|||
|
|||
public virtual async Task UpdateAsync(Category entity, Guid? parentId, string uniqueName, string displayName, string description, |
|||
string mediaResources, bool isHidden) |
|||
{ |
|||
if (await _repository.AnyAsync(x => x.UniqueName == uniqueName && x.Id != entity.Id)) |
|||
{ |
|||
throw new DuplicateCategoryUniqueNameException(); |
|||
} |
|||
|
|||
entity.Update(parentId, uniqueName, displayName, description, mediaResources, isHidden); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Products.Categories |
|||
{ |
|||
public class DuplicateCategoryUniqueNameException : BusinessException |
|||
{ |
|||
public DuplicateCategoryUniqueNameException() : base("DuplicateCategoryUniqueName") |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.Categories |
|||
{ |
|||
public interface ICategoryManager : IDomainService |
|||
{ |
|||
Task<Category> CreateAsync( |
|||
Guid? parentId, |
|||
string uniqueName, |
|||
string displayName, |
|||
string description, |
|||
string mediaResources, |
|||
bool isHidden); |
|||
|
|||
Task UpdateAsync( |
|||
Category entity, |
|||
Guid? parentId, |
|||
string uniqueName, |
|||
string displayName, |
|||
string description, |
|||
string mediaResources, |
|||
bool isHidden); |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,45 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class UpgradedPaymentServiceTo1_10_2 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "PendingTopUpPaymentId", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts", |
|||
type: "uniqueidentifier", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<decimal>( |
|||
name: "PendingWithdrawalAmount", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts", |
|||
type: "decimal(18,2)", |
|||
nullable: false, |
|||
defaultValue: 0m); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "PendingWithdrawalRecordId", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts", |
|||
type: "uniqueidentifier", |
|||
nullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "PendingTopUpPaymentId", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PendingWithdrawalAmount", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PendingWithdrawalRecordId", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,42 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class RemovedUniqueIndexOfCategoryUniqueName : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropIndex( |
|||
name: "IX_EasyAbpEShopProductsCategories_UniqueName", |
|||
table: "EasyAbpEShopProductsCategories"); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "UniqueName", |
|||
table: "EasyAbpEShopProductsCategories", |
|||
type: "nvarchar(max)", |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(450)", |
|||
oldNullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "UniqueName", |
|||
table: "EasyAbpEShopProductsCategories", |
|||
type: "nvarchar(450)", |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(max)", |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_EasyAbpEShopProductsCategories_UniqueName", |
|||
table: "EasyAbpEShopProductsCategories", |
|||
column: "UniqueName", |
|||
unique: true, |
|||
filter: "[UniqueName] IS NOT NULL"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue