Files
Backend-Api/CompanyManagment.Application/PaymentToEmployeeItemsApplication.cs
2024-07-05 21:36:15 +03:30

54 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.EmployeeAgg;
using Company.Domain.PaymentToEmployeeItemAgg;
using CompanyManagment.App.Contracts.PaymentToEmployee;
using CompanyManagment.EFCore;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.Application;
public class PaymentToEmployeeItemsApplication : IPaymentToEmployeeItemApplication
{
private IPaymentToEmployeeItemRepository _paymentToEmployeeItemRepository;
public PaymentToEmployeeItemsApplication(IPaymentToEmployeeItemRepository paymentToEmployeeItemRepository)
{
_paymentToEmployeeItemRepository = paymentToEmployeeItemRepository;
}
public OperationResult Create(CreatePaymentToEmployeeItem command)
{
var opration = new OperationResult();
var createItems = new PaymentToEmployeeItem(
command.EmployeeId,
command.WorkshopId,
command.PaymentToEmployeeId,
command.PaymentFa.MoneyToDouble(),
command.PayDateFa.ToGeorgianDateTime(),
command.PaymentMetod,
command.SourceBankName,
command.SourceBankAccountNumber,
command.TypeSourceBankNumber,
command.DestinationBankName,
command.DestinationBankAccountNumber,
command.TypeDestinationBankNumber,
command.BankCheckNumber,
command.CashDescription,
command.PaymentTitle
);
_paymentToEmployeeItemRepository.Create(createItems);
_paymentToEmployeeItemRepository.SaveChanges();
return opration.Succcedded();
}
}