public async Task <LimitResult> RegisterLimitAsync(Limit limit) { var failedValidation = ValidateLimit(limit); if (failedValidation != null) { return(failedValidation); } limit.Id = limit.Id ?? Guid.NewGuid(); _dbContext.Add(limit); try { await _dbContext.SaveChangesAsync(); return(LimitResult.SuccessResult); } catch (Exception exception) { return(LimitResult.FailureResult); } }
public async Task <AccountResult <Card> > RegisterCardAsync(CardInfo cardInfo) { var failedValidation = ValidateCard <Card>(cardInfo); if (failedValidation != null) { return(failedValidation); } cardInfo.Id = cardInfo.Id ?? Guid.NewGuid(); _dbContext.Add(cardInfo); try { await _dbContext.SaveChangesAsync(); return(AccountResult <Card> .SuccessResult); } catch (Exception exception) { return(AccountResult <Card> .FailureResult); } }