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

            if (id != iN_Requisition.RequisID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult GetIN_Requisition(int id)
        {
            IN_Requisition iN_Requisition = db.IN_Requisition.Find(id);

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

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

            db.IN_Requisition.Add(iN_Requisition);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = iN_Requisition.RequisID }, iN_Requisition));
        }
예제 #4
0
        public IHttpActionResult DeleteIN_Requisition(int id)
        {
            IN_Requisition iN_Requisition = db.IN_Requisition.Find(id);

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

            db.IN_Requisition.Remove(iN_Requisition);
            db.SaveChanges();

            return(Ok(iN_Requisition));
        }