Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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;
 }