Compare commits
No commits in common. "6e9e819b8d7761e0598628dae6589368bb7e17c3" and "3906d70ecafe2f8d188038e5202d99f73a8d11e2" have entirely different histories.
6e9e819b8d
...
3906d70eca
@ -59,54 +59,13 @@ namespace BankDatabaseImplement.Implements
|
||||
using var context = new BankDatabase();
|
||||
var newWithdrawal = Withdrawal.Create(context, model);
|
||||
if (newWithdrawal == null)
|
||||
{
|
||||
return null;
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
//MakeWithdrawal(context, model);
|
||||
context.Withdrawals.Add(newWithdrawal);
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
context.Withdrawals.Add(newWithdrawal);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return newWithdrawal.GetViewModel;
|
||||
}
|
||||
|
||||
//private bool MakeWithdrawal(BankDatabase context, WithdrawalBindingModel model)
|
||||
//{
|
||||
// if (model == null)
|
||||
// return false;
|
||||
// var dictionary = model.WithdrawalAccounts;
|
||||
// int count = model.Sum;
|
||||
// foreach (var el in dictionary)
|
||||
// {
|
||||
// int dif = count;
|
||||
// if (el.Count < dif)
|
||||
// dif = el.Count;
|
||||
// el.Count -= dif;
|
||||
// count -= dif;
|
||||
// if (el.Count == 0)
|
||||
// {
|
||||
// dictionary.Add(el);
|
||||
// }
|
||||
// if (count == 0)
|
||||
// break;
|
||||
// }
|
||||
// if (count > 0)
|
||||
// {
|
||||
// transaction.Rollback();
|
||||
// return false;
|
||||
// }
|
||||
// foreach (var el in dictionary)
|
||||
// {
|
||||
// context.ShopManufactures.Remove(el);
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
return newWithdrawal.GetViewModel;
|
||||
}
|
||||
|
||||
public WithdrawalViewModel? Update(WithdrawalBindingModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user