Example #1
0
        public IHttpActionResult PostDeliveryNoteOutward(DeliveryNoteOutward deliveryNoteOutward)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DeliveryNoteOutwards.Add(deliveryNoteOutward);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (DeliveryNoteOutwardExists(deliveryNoteOutward.OutwardDelID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = deliveryNoteOutward.OutwardDelID }, deliveryNoteOutward));
        }
Example #2
0
        public IHttpActionResult PutDeliveryNoteOutward(string id, DeliveryNoteOutward deliveryNoteOutward)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != deliveryNoteOutward.OutwardDelID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult GetDeliveryNoteOutward(string id)
        {
            DeliveryNoteOutward deliveryNoteOutward = db.DeliveryNoteOutwards.Find(id);

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

            return(Ok(deliveryNoteOutward));
        }
Example #4
0
        public IHttpActionResult DeleteDeliveryNoteOutward(string id)
        {
            DeliveryNoteOutward deliveryNoteOutward = db.DeliveryNoteOutwards.Find(id);

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

            db.DeliveryNoteOutwards.Remove(deliveryNoteOutward);
            db.SaveChanges();

            return(Ok(deliveryNoteOutward));
        }