/// <inheritdoc /> public async Task CreateOrder(Order order, Domain.Model.OrderContext context) { using (var transaction = await _db.BeginTransactionAsync()) { await _db.Orders.InsertAsync(() => new Context.Order { Id = order.Id, ApplicantId = order.ApplicantId, State = order.State.ToString(), DateAdd = order.DateAdd, ProductId = order.ProductId, }); await _db.OrderContexts.InsertAsync(() => new OrderContext { OrderId = order.Id, Ip = context.Ip, Utm = context.Utm, GoogleAnalyticsId = context.GoogleAnalyticsId, Region = context.Region, Browser = context.Browser, BrowserUserAgent = context.BrowserUserAgent }); await transaction.CommitAsync(); } }
/// <inheritdoc /> public async Task UpdateOrder(Order order) { var updated = await _db.Orders.UpdateAsync(o => o.Id == order.Id, o => new Context.Order { State = order.State.ToString() }); if (updated <= 0) { throw new EntityNotFoundException(); } }