This commit is contained in:
2023-07-21 21:06:45 +03:00
parent 2f108bef4f
commit fa5a8a9001
37 changed files with 2319 additions and 28 deletions
@@ -83,12 +83,26 @@ public class CurrencyService
exists.Name = currency.Name;
exists.ShortName = currency.ShortName;
exists.IsPrimary = currency.IsPrimary;
if (!_currencyRepository.Update(exists))
{
return result.Set(CurrencyEditStatus.failed);
}
if (exists.IsPrimary)
{
var primaries = _currencyRepository.GetPrimaries(userId);
foreach (var primary in primaries)
{
if (primary.Id != exists.Id)
{
primary.IsPrimary = false;
_currencyRepository.Update(primary);
}
}
}
return result.Set(exists);
}