public IHttpActionResult PostPosition(Position position) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Positions.Add(position); try { db.SaveChanges(); } catch (DbUpdateException) { if (PositionExists(position.ID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = position.ID }, position); }
public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Position position, string remark = "", Guid? purchaseOrderItemID = null) { AddItem(productSkuInfo, quantity, weight, price, productNumber, position.ID, remark, purchaseOrderItemID); }
public IHttpActionResult PutPosition(Guid id, Position position) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != position.ID) { return BadRequest(); } db.Entry(position).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PositionExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }