Пример #1
0
        // POST: odata/Orders
        public async Task<IHttpActionResult> Post(Order order)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _db.Orders.Add(order);
            await _db.SaveChangesAsync();

            return Created(order);
        }
        public async Task<IHttpActionResult> Post(Order order)
        {
            order.OrderId = SequentialGuidGenerator.Generate(SequentialGuidType.SequentialAtEnd);

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _db.Orders.Add(order);
            await _db.SaveChangesAsync();

            return Created(order);
        }