public async Task <Cuenta> CreateCuentaRootAsync(string numero, CuentaTypeEnum tipo, string monedaId, BalanceTypeEnum balance, string nombre) { if (formatProvider.GetLevelOf(numero) != 0) { throw new NumeroCuentaNotRootException(numero, nameof(numero)); } return(await CreateCuentaAsync(numero, tipo, monedaId, balance, nombre)); }
public Cuenta(string id, string parentId, CuentaTypeEnum tipo, Moneda moneda, BalanceTypeEnum balance) : this() { Check.NotNull(moneda, nameof(moneda)); Check.NotNull(id, nameof(id)); Check.NotNull(moneda, nameof(moneda)); Id = id; if (!string.IsNullOrEmpty(parentId)) { ParentId = parentId; } Tipo = tipo; Moneda = moneda; Balance = balance; }
private async Task <Cuenta> CreateCuentaAsync(string numero, CuentaTypeEnum tipo, string monedaId, BalanceTypeEnum balance, string nombre) { numero = CheckNumero(numero, nameof(numero)); if (await cuentaStore.AnyAsync(x => x.Id == numero)) { throw new CuentaDuplicadaException(numero); } var moneda = await monedaManager.GetAsync(monedaId); var cuenta = new Cuenta(numero, null, tipo, moneda, balance) { Nombre = nombre }; await cuentaStore.InsertAsync(cuenta, autoSave : true); return(cuenta); }
public static string CuentaTypeEnumToString(CuentaTypeEnum input) { return(input.ToString("g")); }