Exemplo n.º 1
0
        public IHttpActionResult PostPaymentReceiptMaster(PaymentReceiptMaster paymentReceiptMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PaymentReceiptMasters.Add(paymentReceiptMaster);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (PaymentReceiptMasterExists(paymentReceiptMaster.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = paymentReceiptMaster.ID }, paymentReceiptMaster));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutPaymentReceiptMaster(long id, PaymentReceiptMaster paymentReceiptMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paymentReceiptMaster.ID)
            {
                return(BadRequest());
            }

            db.Entry(paymentReceiptMaster).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PaymentReceiptMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetPaymentReceiptMaster(long id)
        {
            PaymentReceiptMaster paymentReceiptMaster = db.PaymentReceiptMasters.Find(id);

            if (paymentReceiptMaster == null)
            {
                return(NotFound());
            }

            return(Ok(paymentReceiptMaster));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeletePaymentReceiptMaster(long id)
        {
            PaymentReceiptMaster paymentReceiptMaster = db.PaymentReceiptMasters.Find(id);

            if (paymentReceiptMaster == null)
            {
                return(NotFound());
            }

            db.PaymentReceiptMasters.Remove(paymentReceiptMaster);
            db.SaveChanges();

            return(Ok(paymentReceiptMaster));
        }