public async Task <PayerDto> GetPatientPayerInfo(string payerId) { var _payerId = 0; try { _payerId = int.Parse(payerId); } catch { PayerDto payerDto = new PayerDto { PayerType = null, dateadded = null, AccountCatId = null, AccountCategory = null }; return(payerDto); } var result = await _context.Payer.Where(p => p.PayerId == _payerId) .Select(c => new PayerDto() { AccountCategory = _context.AccountCategory.Where(ca => ca.Accountcatid == c.accountcatid).FirstOrDefault(), AccountCatId = c.accountcatid, dateadded = c.dateadded, PayerId = c.PayerId, PayerType = c.PayerType }).FirstOrDefaultAsync(); return(result); }
public IActionResult AddPayer([FromBody] PayerDto payerDto, Guid companyId) { var result = _storage.AddNewPayer(payerDto, companyId); if (result != Guid.Empty) { return(Ok()); } else { return(Conflict()); } }
public IActionResult EditPayer([FromBody] PayerDto payerDto) { var result = _storage.EditPayer(payerDto); if (result) { return(Ok()); } else { return(Conflict()); } }
public Guid AddNewPayer(PayerDto payerDto, Guid companyId) { using var transaction = _dbContext.Database.BeginTransaction(); try { var id = AddPayerToCompany(payerDto, companyId); transaction.Commit(); return(id); } catch (Exception e) { transaction.Rollback(); return(Guid.Empty); } }
private Guid AddPayerToCompany(PayerDto payerDto, Guid companyId) { var payer = _dbContext.Payers.FirstOrDefault(x => x.Id == payerDto.Id); if (payer == null) { var newPayer = new Payer { CompanyId = companyId, Name = payerDto.Name }; _dbContext.Payers.Add(newPayer); _dbContext.SaveChanges(); return(newPayer.Id); } return(Guid.Empty); }
public async Task <ActionResult> ProcessPayment([FromBody] PayerDto payerDto) { User user = await AuthenticateUser(); Payment payment = await Get <InsertNewPaymentCommand>().Execute(user); PaymentDto paymentDto = new PaymentDto { Description = payment.Description, Control = $"{payment.Id}:{payment.UserId}" }; paymentDto.SetPayerAndUrls(payerDto, Get <EndpointConfig>()); paymentDto.SetPaymentsConfiguration(Get <PaymentConfiguration>()); string redirectUrl = await Get <CreatePaymentLinkCommand>().Execute(paymentDto); return(Json(redirectUrl)); }
public bool EditPayer(PayerDto payerDto) { using var transaction = _dbContext.Database.BeginTransaction(); try { var payer = _dbContext.Payers.FirstOrDefault(x => x.Id == payerDto.Id); if (payer != null) { payer.Name = payerDto.Name; _dbContext.SaveChanges(); transaction.Commit(); return(true); } else { return(false); } } catch (Exception e) { transaction.Rollback(); return(false); } }
public PayerDto CreateNewPayer(PayerDto payer) { throw new NotImplementedException(); }
public PayerDto VerifyInsurance(PayerDto insurance, long patientId) { throw new NotImplementedException(); }
public PayerDto UpdatePayer(PayerDto updatedPayer) { throw new NotImplementedException(); }
public PayerDto.PayerStatusDto RequestPayerStatus(PayerDto payer, string recordNum) { throw new NotImplementedException(); }