Фиксы для создания сделки
This commit is contained in:
parent
9201113e0d
commit
c3e2a54710
@ -45,14 +45,24 @@ namespace BankDatabaseImplement.Implements
|
||||
}
|
||||
public OperatorViewModel? GetElement(OperatorSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Login) && string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new BankDatabase();
|
||||
return context.Operators
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
if (!string.IsNullOrEmpty(model.Login) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Operators
|
||||
.FirstOrDefault(x => x.Login == model.Login && x.Password == model.Password)
|
||||
?.GetViewModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Operators
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
}
|
||||
public OperatorViewModel? Insert(OperatorBindingModel model)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace BankDatabaseImplement.Models
|
||||
public int OperatorId { get; set; }
|
||||
public virtual Operator Operator { get; set; } = new();
|
||||
public int? CreditProgramId {get; set; }
|
||||
public virtual CreditProgram CreditProgram { get; set; } = new();
|
||||
public virtual CreditProgram? CreditProgram { get; set; }
|
||||
[ForeignKey("DealId")]
|
||||
public virtual List<DealPayment> DealPayments { get; set; } = new();
|
||||
public static Deal? Create(BankDatabase context, DealBindingModel model)
|
||||
|
@ -127,7 +127,7 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIClient.PostRequest("api/main/createorder", new DealBindingModel
|
||||
APIClient.PostRequest("api/deal/createdeal", new DealBindingModel
|
||||
{
|
||||
ClientId = clientid,
|
||||
OperatorId = APIClient.Operator.Id,
|
||||
|
Loading…
Reference in New Issue
Block a user