예제 #1
0
        public IHttpActionResult PutpaymentEFT(int id, paymentEFT paymentEFT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paymentEFT.cardnumber)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult GetpaymentEFT(int id)
        {
            paymentEFT paymentEFT = db.paymentEFTs.Find(id);

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

            return(Ok(paymentEFT));
        }
예제 #3
0
        public IHttpActionResult PostpaymentEFT(paymentEFT paymentEFT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.paymentEFTs.Add(paymentEFT);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = paymentEFT.cardnumber }, paymentEFT));
        }
예제 #4
0
        public IHttpActionResult DeletepaymentEFT(int id)
        {
            paymentEFT paymentEFT = db.paymentEFTs.Find(id);

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

            db.paymentEFTs.Remove(paymentEFT);
            db.SaveChanges();

            return(Ok(paymentEFT));
        }