public IActionResult AddPatientInvoiceReturn([FromBody] PatientInvoiceReturn model)
 {
     if (model.ReturnDate == null)
     {
         model.ReturnDate = DateTime.Now;
     }
     model.InvoiceReturnNumber = GenPIRN();
     Return_repo.Add(model);
     return(new OkObjectResult(new { PatientInvoiceReturnID = model.PatientInvoiceReturnId }));
 }
        public IActionResult DeletePatientInvoiceReturn(long id)
        {
            PatientInvoiceReturn patientInvoiceReturn = Return_repo.Find(id);

            if (patientInvoiceReturn == null)
            {
                return(NotFound());
            }
            Returnitem_repo.DeleteRange(Returnitem_repo.GetAll().Where(a => a.PatientInvoiceReturnId == patientInvoiceReturn.PatientInvoiceReturnId));

            Return_repo.Delete(patientInvoiceReturn);
            return(Ok());
        }
 public IActionResult UpdatePatientInvoiceReturn([FromBody] PatientInvoiceReturn model)
 {
     Return_repo.Update(model);
     return(new OkObjectResult(new { PatientInvoiceReturnID = model.PatientInvoiceReturnId }));
 }