Пример #1
0
        public IHttpActionResult PostReceiptDelay(ReceiptDelay receiptdelay)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ReceiptDelays.Add(receiptdelay);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ReceiptDelayExists(receiptdelay.receiptDelayId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = receiptdelay.receiptDelayId }, receiptdelay));
        }
Пример #2
0
        // PUT api/ReceiptDelay/5
        public IHttpActionResult PutReceiptDelay(int id, ReceiptDelay receiptdelay)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != receiptdelay.receiptDelayId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult GetReceiptDelay(int id)
        {
            ReceiptDelay receiptdelay = db.ReceiptDelays.Find(id);

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

            return(Ok(receiptdelay));
        }
Пример #4
0
        public IHttpActionResult DeleteReceiptDelay(int id)
        {
            ReceiptDelay receiptdelay = db.ReceiptDelays.Find(id);

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

            db.ReceiptDelays.Remove(receiptdelay);
            db.SaveChanges();

            return(Ok(receiptdelay));
        }