Crediting change
This commit is contained in:
parent
d0ec922743
commit
191d34b8a5
@ -107,13 +107,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Сумма операции должна быть больше 0", nameof(model.Sum));
|
||||
}
|
||||
if (model.Date > DateTime.Now)
|
||||
if (model.DateOpen > DateTime.Now)
|
||||
{
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.Date));
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.DateOpen));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Crediting. Sum:{Sum}.CardId:{CardId}.Date:{date}.Id:{Id}",
|
||||
model.Sum, model.CardId, model.Date.ToString(), model.Id);
|
||||
model.Sum, model.CardId, model.DateOpen.ToString(), model.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
return _creditingStorage.GetFilteredList(new CreditingSearchModel
|
||||
{
|
||||
dateFrom = model.DateFrom,
|
||||
dateTo = model.DateTo,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
}).Select(x => new ReportClientViewModel
|
||||
{
|
||||
CardId = x.CardId,
|
||||
SumOperation = x.Sum,
|
||||
DateComplite = x.Date
|
||||
DateComplite = x.DateOpen
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@ -51,8 +51,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
return _debitingStorage.GetFilteredList(new DebitingSearchModel
|
||||
{
|
||||
DateOpen = model.DateFrom,
|
||||
DateClose = model.DateTo,
|
||||
DateTo = model.DateFrom,
|
||||
DateFrom = model.DateTo,
|
||||
}).Select(x => new ReportClientViewModel
|
||||
{
|
||||
CardId = x.CardId,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -15,6 +16,10 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public int Sum { get; set; }
|
||||
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime? DateClose { get; set; }
|
||||
|
||||
public StatusEnum Status { get; set; } = StatusEnum.Открыта;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,6 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public DateTime? DateClose { get; set; }
|
||||
|
||||
public StatusEnum Status { get; set; }
|
||||
public StatusEnum Status { get; set; } = StatusEnum.Открыта;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -14,8 +15,10 @@ namespace BankYouBankruptContracts.SearchModels
|
||||
|
||||
public int? Sum { get; set; }
|
||||
|
||||
public DateTime? dateFrom { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? dateTo { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public StatusEnum? Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ namespace BankYouBankruptContracts.SearchModels
|
||||
|
||||
public int? Sum { get; set; }
|
||||
|
||||
public DateTime? DateOpen { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateClose { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public StatusEnum? Status { get; set; }
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -20,7 +21,13 @@ namespace BankYouBankruptContracts.ViewModels
|
||||
[DisplayName("Сумма операции")]
|
||||
public int Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата операции")]
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
[DisplayName("Дата открытия заявки")]
|
||||
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Дата закрытия заявки")]
|
||||
public DateTime? DateClose { get; set; }
|
||||
|
||||
[DisplayName("Статус заявки")]
|
||||
public StatusEnum Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -13,6 +14,10 @@ namespace BankYouBankruptDataModels.Models
|
||||
|
||||
int Sum { get; }
|
||||
|
||||
DateTime Date { get; }
|
||||
DateTime DateOpen { get; }
|
||||
|
||||
DateTime? DateClose { get; }
|
||||
|
||||
StatusEnum Status { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -24,8 +25,12 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
public int Sum { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime? DateClose { get; set; }
|
||||
|
||||
[Required]
|
||||
public StatusEnum Status { get; set; }
|
||||
|
||||
public CreditingViewModel GetViewModel => new()
|
||||
{
|
||||
@ -33,7 +38,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
CardId = CardId,
|
||||
CardNumber = Card.Number,
|
||||
Sum = Sum,
|
||||
Date = Date
|
||||
DateOpen = DateOpen
|
||||
};
|
||||
|
||||
public static Crediting Create(BankYouBancruptDatabase context, CreditingBindingModel model)
|
||||
@ -44,13 +49,14 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
CardId = model.CardId,
|
||||
Card = context.Cards.First(x => x.Id == model.CardId),
|
||||
Sum = model.Sum,
|
||||
Date = model.Date
|
||||
DateOpen = model.DateOpen
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CreditingBindingModel model)
|
||||
{
|
||||
Date = model.Date;
|
||||
DateClose = model.DateClose;
|
||||
Status = model.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,10 +77,11 @@ namespace BankYouBankruptRestApi.Controllers
|
||||
try {
|
||||
_creditingLogic.Create(model);
|
||||
|
||||
_accountLogic.ChangeBalance(new AccountSearchModel
|
||||
{
|
||||
Id = _cardLogic.ReadElement(new CardSearchModel { Id = model.CardId }).AccountId
|
||||
}, model.Sum);
|
||||
|
||||
//_accountLogic.ChangeBalance(new AccountSearchModel
|
||||
//{
|
||||
// Id = _cardLogic.ReadElement(new CardSearchModel { Id = model.CardId }).AccountId
|
||||
//}, model.Sum);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания операции на пополнение");
|
||||
|
Loading…
Reference in New Issue
Block a user