コード例 #1
0
        public bool CreateSubscriptionAddToCart(SubscriptionType type)
        {
            SubscriptionTypeLogic typeLOgic = new SubscriptionTypeLogic();
            SubscriptionType      subType   = typeLOgic.CreateSubscriptionWithProduct(type);

            if (subType == null && String.IsNullOrEmpty(typeLOgic.ErrorMessage))
            {
                ErrorMessage = typeLOgic.ErrorMessage;
            }
            else
            {
                CartItem item = new CartItem()
                {
                    SubscriptionTypeId = subType.Id,
                    DateCreated        = DateTime.Now.Date,
                    Quantity           = 1,
                    UserId             = type.CreatedBy,
                    Price = subType.Price
                };
                CartLogic logic  = new CartLogic();
                var       status = logic.CreateCartItem(item);
                if (!status)
                {
                    ErrorMessage = logic.ErrorMessage;
                }
            }
            return(String.IsNullOrEmpty(ErrorMessage));
        }
コード例 #2
0
        public HttpResponseMessage CreateSubscription(SubscriptionType type)
        {
            var subscriptionType = logic.CreateSubscriptionWithProduct(type);

            if (subscriptionType != null)
            {
                return(Request.CreateResponse(HttpStatusCode.Created, subscriptionType));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, logic.ErrorMessage));
            }
        }