public async Task UpdateOrderStatus(int id, int status_id) { using (B2COrderEntities entities = new B2COrderEntities()) { order order = await entities.order.FirstOrDefaultAsync(x => x.id == id); order.status_id = status_id; entities.Entry(order).State = EntityState.Modified; await entities.SaveChangesAsync(); } }
public async Task <int> CreateOrder(order order) { order.status_id = 1; using (TransactionScope transaction = new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted }, TransactionScopeAsyncFlowOption.Enabled)) { using (B2COrderEntities entities = new B2COrderEntities()) { entities.order.Add(order); await entities.SaveChangesAsync(); } transaction.Complete(); } foreach (item item in order.items) { switch ((product_type)item.product_type_id) { case product_type.Lodging: await CreateReserveLodging(item); break; case product_type.Transport: await CreateReserveTransport(item); break; case product_type.Show: break; default: throw new NotImplementedException("Not Implemented Integration For Product Type Id: " + item.product_type_id); } } return(order.id); }