public static CaseInsuranceDTO ToInsuranceDTO(CaseInsurance caseInsurance) { var dto = new CaseInsuranceDTO { Id = caseInsurance.ID, InsuranceCaseId = caseInsurance.CaseID, InsuranceId = caseInsurance.InsuranceID, InsuranceCarrierId = caseInsurance.CarrierID, MemberName = caseInsurance.MemberName, MemberId = caseInsurance.MemberId, PrimaryCardholderName = caseInsurance.PrimaryCardholderName, DatePlanEffective = caseInsurance.DatePlanEffective, DatePlanTerminated = caseInsurance.DatePlanTerminated, HardshipWaiverApplied = caseInsurance.HardshipWaiverApplied, HardshipWaiverApproved = caseInsurance.HardshipWaiverApproved, HardshipWaiverLike = caseInsurance.HardshipWaiverLike, OtherNotes = caseInsurance.OtherNotes, FundingType = caseInsurance.FundingType, BenefitType = caseInsurance.BenefitType, CoInsuranceAmount = caseInsurance.CoInsuranceAmount, CoPayAmount = caseInsurance.CoPayAmount, DeductibleTotal = caseInsurance.DeductibleTotal, MaxOutOfPocket = caseInsurance.CaseInsurancesMaxOutOfPocket .OrderByDescending(c => c.EffectiveDate) .ToList() .Select(m => ToCaseInsuranceMaxOutOfPocketDTO(m)) }; return(dto); }
public CaseInsuranceDTO GetInsurance(int id) { CaseInsuranceDTO dto = null; var insurance = _context.CaseInsurances.Where(c => c.ID == id).SingleOrDefault(); if (insurance != null) { dto = Mapper.ToInsuranceDTO(insurance); } return(dto); }
public ActionResult SaveInsurance(CaseInsuranceDTO caseInsuranceDTO) { object response; try { response = _service.SaveInsurance(caseInsuranceDTO); } catch (Exception e) { response = new { Error = e.Message }; } return(this.CamelCaseJson(response)); }
public CaseInsuranceDTO InsertInsurance(CaseInsuranceDTO dto) { var caseInsurance = _context.CaseInsurances.Create(); caseInsurance.CaseID = dto.InsuranceCaseId; Mapper.ToCaseInsurance(dto, caseInsurance); if (!new CaseInsuranceValidationService(_context).ValidateInsuranceUpdate(caseInsurance.CaseID, caseInsurance)) { throw new InvalidOperationException("The insurance cannot be applied because it will overlap with an existing insurance entry."); } _context.CaseInsurances.Add(caseInsurance); _context.SaveChanges(); PatientSearchService.UpdateEntry(caseInsurance.Case.PatientID); return(Mapper.ToInsuranceDTO(caseInsurance)); }
public CaseInsuranceDTO SaveInsurance(CaseInsuranceDTO dto) { var caseInsurance = _context.CaseInsurances.SingleOrDefault(m => m.ID == dto.Id); if (caseInsurance == null) { throw new Exception(); } Mapper.ToCaseInsurance(dto, caseInsurance); if (!new CaseInsuranceValidationService(_context).ValidateInsuranceUpdate(caseInsurance.CaseID, caseInsurance)) { throw new InvalidOperationException("The insurance cannot be applied because it will overlap with an existing insurance entry."); } _context.SaveChanges(); PatientSearchService.UpdateEntry(caseInsurance.Case.PatientID); return(Mapper.ToInsuranceDTO(caseInsurance)); }
public static void ToCaseInsurance(CaseInsuranceDTO dto, CaseInsurance caseInsurance) { caseInsurance.InsuranceID = dto.InsuranceId; caseInsurance.CarrierID = dto.InsuranceCarrierId; caseInsurance.MemberName = dto.MemberName; caseInsurance.MemberId = dto.MemberId; caseInsurance.PrimaryCardholderName = dto.PrimaryCardholderName; caseInsurance.DatePlanEffective = dto.DatePlanEffective; caseInsurance.DatePlanTerminated = dto.DatePlanTerminated; caseInsurance.HardshipWaiverApplied = dto.HardshipWaiverApplied; caseInsurance.HardshipWaiverApproved = dto.HardshipWaiverApproved; caseInsurance.HardshipWaiverLike = dto.HardshipWaiverLike; caseInsurance.OtherNotes = dto.OtherNotes; caseInsurance.FundingType = dto.FundingType; caseInsurance.BenefitType = dto.BenefitType; caseInsurance.CoInsuranceAmount = dto.CoInsuranceAmount; caseInsurance.CoPayAmount = dto.CoPayAmount; caseInsurance.DeductibleTotal = dto.DeductibleTotal; }