private IBookOrder GetOpenOrder(IEntitySession session, LockType lockType, bool create = false) { var currUserId = Context.User.UserId; var openOrder = session.EntitySet <IBookOrder>(lockType) .Where(bo => bo.User.Id == currUserId && bo.Status == OrderStatus.Open).FirstOrDefault(); if (openOrder == null && create) { var user = session.GetEntity <IUser>(Context.User.UserId); openOrder = session.NewOrder(user); } return(openOrder); }
private IBookOrder GetOpenOrder(IEntitySession session, LockOptions lockOptions, bool create = false) { var currUserId = Context.User.UserId; var openOrder = session.EntitySet<IBookOrder>(lockOptions) .Where(bo => bo.User.Id == currUserId && bo.Status == OrderStatus.Open).FirstOrDefault(); if (openOrder == null && create) { var user = session.GetEntity<IUser>(Context.User.UserId); openOrder = session.NewOrder(user); } return openOrder; }