Add IsActive to group
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.PaymentInstrumentAgg;
|
||||
@@ -8,13 +9,20 @@ public class PaymentInstrumentGroup:EntityBase
|
||||
public PaymentInstrumentGroup(string name)
|
||||
{
|
||||
Name = name;
|
||||
IsActive = IsActive.True;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public List<PaymentInstrument> PaymentInstruments { get; set; }
|
||||
|
||||
public void Edit(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public void DeActive()
|
||||
{
|
||||
IsActive = IsActive.False;
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,8 @@ public class PaymentInstrumentApplication:IPaymentInstrumentApplication
|
||||
{
|
||||
return op.Failed("عنوان مورد نظر یافت نشد");
|
||||
}
|
||||
_paymentInstrumentGroupRepository.Remove(paymentInstrumentGroup);
|
||||
|
||||
paymentInstrumentGroup.DeActive();
|
||||
await _paymentInstrumentGroupRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
10203
CompanyManagment.EFCore/Migrations/20250805123156_Add PaymentInstrument Group IsActive.Designer.cs
generated
Normal file
10203
CompanyManagment.EFCore/Migrations/20250805123156_Add PaymentInstrument Group IsActive.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPaymentInstrumentGroupIsActive : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "IsActive",
|
||||
table: "PaymentInstrumentGroups",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsActive",
|
||||
table: "PaymentInstrumentGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4343,6 +4343,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("IsActive")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.PaymentInstrumentAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||
@@ -20,7 +21,7 @@ public class PaymentInstrumentGroupRepository : RepositoryBase<long, PaymentInst
|
||||
|
||||
public async Task<List<PaymentInstrumentGroupsViewModel>> GetList()
|
||||
{
|
||||
return await _context.PaymentInstrumentGroups.AsNoTracking()
|
||||
return await _context.PaymentInstrumentGroups.Where(x=>x.IsActive == IsActive.True).AsNoTracking()
|
||||
.Select(x => new PaymentInstrumentGroupsViewModel()
|
||||
{
|
||||
Name = x.Name,
|
||||
|
||||
Reference in New Issue
Block a user