private ProvidentFundAccountDoc CreateAccount(String userId, Mimshak item, HeshbonOPolisa policy) { ProvidentFundAccountDoc account; try { account = new ProvidentFundAccountDoc { UserId = userId, ProviderName = item.YeshutYatzran?.ShemYatzran, PolicyId = policy.MisparPolisaOheshbon, PolicyStatus = policy.StatusPolisaOcheshbon == 1 ? PolicyStatus.Active : PolicyStatus.Inactive, PolicyOpeningDate = Reader.ConvertStringToDate(policy.TaarichHitztarfutMutzar), ValidationDate = Reader.ConvertStringToDate(policy.TaarichNechonut) }; } catch (Exception e) { Console.WriteLine(e); throw; } return(account); }
public async Task AddAccount(ProvidentFundAccountDoc item) { try { await _context.LifeInsurAccounts.InsertOneAsync(item); } catch (Exception ex) { // log or manage the exception throw ex; } }
public async Task <bool> UpdateAccount(Guid id, ProvidentFundAccountDoc account) { try { ReplaceOneResult actionResult = await _context.LifeInsurAccounts.ReplaceOneAsync(a => a.Id.Equals(id), account, new UpdateOptions { IsUpsert = true }); return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0); } catch (Exception ex) { // log or manage the exception throw ex; }; }