コード例 #1
0
        public IHttpActionResult PutSupplier_Item_Invoice(int id, Supplier_Item_Invoice supplier_Item_Invoice)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != supplier_Item_Invoice.Id)
            {
                return BadRequest();
            }

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #2
0
        public IHttpActionResult PostSupplier_Item_Invoice(Supplier_Item_Invoice supplier_Item_Invoice)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Supplier_Item_Invoice.Add(supplier_Item_Invoice);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = supplier_Item_Invoice.Id }, supplier_Item_Invoice);
        }