public async Task <HdlBillPayment> DeleteHdlBillPayment(HdlBillPayment hdlBillPayment)
        {
            var url = URLBuilder.GetURL(Controllers.FINANCE, EndPoint.FINANCE_HDL_BILL_PAYMENT_DELETE);

            return(await requestProvider.DeleteAsync(url, hdlBillPayment, new Dictionary <string, string> {
                ["id"] = hdlBillPayment.Id.ToString()
            }));
        }
        public void InsertHdlBillPayment(HdlBillPayment hdlBillPayment)
        {
            hdlBillPaymentRepository.Insert(hdlBillPayment);

            var billFromDb = hdlBillRepository.Get(hdlBillPayment.BillId);

            if (billFromDb != null)
            {
                billFromDb.AmountPaid = hdlBillPayment.PaymentAmount;
                billFromDb.Balance    = hdlBillPayment.Balance;
                hdlBillRepository.Update(billFromDb);
            }
        }
 public ActionResult UpdateHdlBillPayment(HdlBillPayment hdlBillPayment)
 {
     if (hdlBillPayment != null)
     {
         try
         {
             financeService.UpdateHdlBillPayment(hdlBillPayment);
         }
         catch (Exception e)
         {
             Program.Logger.Error(e);
             return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while updating the bill payment record"))));
         }
         return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS)));
     }
     else
     {
         return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper bill payment details"))));
     }
 }
        public void UpdateHdlBillPayment(HdlBillPayment hdlBillPayment)
        {
            var hdlBillPaymentFromDb = hdlBillPaymentRepository.Get(hdlBillPayment.Id);

            if (hdlBillPaymentFromDb != null)
            {
                _util.CopyProperties(hdlBillPayment, hdlBillPaymentFromDb);
                hdlBillPaymentRepository.Update(hdlBillPaymentFromDb);

                var billFromDb = hdlBillRepository.Get(hdlBillPayment.BillId);
                if (billFromDb != null)
                {
                    billFromDb.AmountPaid = hdlBillPayment.PaymentAmount;
                    billFromDb.Balance    = hdlBillPayment.Balance;
                    hdlBillRepository.Update(billFromDb);
                }
            }
            else
            {
                throw new Exception("This patient bill payment record does not exist");
            }
        }
        public async Task <HdlBillPayment> UpdateHdlBillPayment(HdlBillPayment hdlBillPayment)
        {
            var url = URLBuilder.GetURL(Controllers.FINANCE, EndPoint.FINANCE_HDL_BILL_PAYMENT_UPDATE);

            return(await requestProvider.PutAsync(url, hdlBillPayment));
        }
        public async Task <HdlBillPayment> InsertHdlBillPayment(HdlBillPayment hdlBillPayment)
        {
            var url = URLBuilder.GetURL(Controllers.FINANCE, EndPoint.FINANCE_HDL_BILL_PAYMENT_INSERT);

            return(await requestProvider.PostAsync(url, hdlBillPayment));
        }