Exemplo n.º 1
0
        public async Task <IActionResult> PutPremiumPayment([FromRoute] int id, [FromBody] PremiumPayment premiumPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != premiumPayment.Id)
            {
                return(BadRequest());
            }

            _context.Entry(premiumPayment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PremiumPaymentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PostPremiumPayment([FromBody] PremiumPayment premiumPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.PremiumPayment.Add(premiumPayment);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPremiumPayment", new { id = premiumPayment.Id }, premiumPayment));
        }
Exemplo n.º 3
0
 public void AddPremiumPayment(PremiumPaymentView objPremiumPaymentView)
 {
     using (var premiumrepo = new PremiumPaymentRepository())
     {
         var premium = new PremiumPayment
         {
             IDNumber      = objPremiumPaymentView.PolicyHolderIdNo,
             AmountPaid    = objPremiumPaymentView.AmountPaid,
             Month         = objPremiumPaymentView.Month,
             Date          = DateTime.Now,
             PaymentFor    = "Premium Payment",
             PaymentMethod = "Cash",
             PaymentId     = objPremiumPaymentView.PaymentId
         };
         premiumrepo.Insert(premium);
     }
 }
 public void Archive(PremiumPayment model)
 {
     _PremiumPaymentRepository.Delete(model);
     _datacontext.SaveChanges();
 }
 public void Update(PremiumPayment model)
 {
     _PremiumPaymentRepository.Update(model);
     _datacontext.SaveChanges();
 }
 public void Insert(PremiumPayment model)
 {
     _PremiumPaymentRepository.Insert(model);
     _datacontext.SaveChanges();
 }