Exemplo n.º 1
0
        public async Task ProductSuspend(Guid accountId, ViewOwnerProduct product, DateTime?nextRebillDate)
        {
            if (nextRebillDate.HasValue)
            {
                return;
            }

            if (product.EndDate.HasValue &&
                product.EndDate.Value > DateTime.UtcNow && (product.EndDate.Value - DateTime.UtcNow).TotalDays <= 10)
            {
                return;
            }

            var targetUser = await _auth.AccountGetAsync(accountId);

            var targetUserNotification = await CreateNotification(targetUser);

            var productSuspendNotification = new ProductSuspendNotification(targetUserNotification, product.ProductName, product.EndDate);

            await _repository.SendProductSuspendNotification(productSuspendNotification);
        }
Exemplo n.º 2
0
        protected async Task <IHttpActionResult> CurrentAccountExecuteAsync(AccountExecuteHandlerAsync handler)
        {
            try
            {
                Guid userId;
                if (!Guid.TryParse(User.Identity.GetUserId(), out userId))
                {
                    return(AccountNotFound());
                }

                var user = await _auth.AccountGetAsync(userId);

                if (object.Equals(user, null))
                {
                    return(AccountNotFound());
                }

                return(await handler(user));
            }
            catch (Exception exc) { return(Request.HttpExceptionResult(exc)); }
        }