public Order Find(string orderId) { using var db = new OrderContext(); var entity = db.Find <OrderEntity>(orderId); return(new Order { Id = entity.id, State = (OrderStates)entity.state }); }
public void Save(Order order) { using var db = new OrderContext(); if (order.Id == null) { var orderEntity = CreateNewOrder(order, db); order.Id = orderEntity.id; } else { var fromDb = db.Find <OrderEntity>(order.Id); fromDb.state = (int)order.State; } db.SaveChanges(); }