Exemplo n.º 1
0
        public void SaveCaseInsurancePaymentVM(CaseInsurancePaymentVM n)
        {
            var m = Transform(n);

            if (m.Id == 0)
            {
                _context.CaseInsurancePayments.Add(m);
            }
            _context.SaveChanges();
            n.Id = m.Id;
        }
Exemplo n.º 2
0
        public CaseInsurancePaymentVM Transform(CaseInsurancePayment n)
        {
            var r = new CaseInsurancePaymentVM
            {
                InsurancePaymentAmount = n.Amount,
                PaymentCaseInsuranceId = n.CaseInsuranceId
            };

            if (n.CaseInsurance != null)
            {
                r.PaymentCaseInsuranceName = n.CaseInsurance.Insurance.Name;
            }
            r.Description = n.Description;
            r.Id          = n.Id;
            r.PaymentDate = n.PaymentDate;
            return(r);
        }
Exemplo n.º 3
0
        public CaseInsurancePayment Transform(CaseInsurancePaymentVM n)
        {
            CaseInsurancePayment r;

            if (n.Id > 0)
            {
                r = _context.CaseInsurancePayments.Where(p => p.Id == n.Id).FirstOrDefault();
            }
            else
            {
                r = _context.CaseInsurancePayments.Create();
            }
            r.Amount          = n.InsurancePaymentAmount;
            r.CaseInsuranceId = n.PaymentCaseInsuranceId;
            r.Description     = n.Description;
            r.PaymentDate     = n.PaymentDate;
            return(r);
        }
Exemplo n.º 4
0
 public ActionResult InsurancePaymentSave(CaseInsurancePaymentVM m)
 {
     _service.SaveCaseInsurancePaymentVM(m);
     return(InsurancePaymentForm(m.PaymentCaseInsuranceId, m.Id));
 }