Beispiel #1
0
        public async Task <IHttpActionResult> OwnerProductUnassign(AuthIdViewModel model, Guid accountProductId)
        {
            model = model ?? new AuthIdViewModel {
                AccountId = Guid.Parse(User.Identity.GetUserId())
            };

            return(await OwnerProductExecuteAsync(async delegate(Guid accountId, ViewOwnerProduct product)
            {
                var user = await _auth.AccountGetAsync(model.AccountId);
                if (!object.Equals(user, null) && !product.IsFree && !product.IsTrial && !product.IsDisabled)
                {
                    var statusResult = await _authProduct.ProductUnassignAsync(new AccountProductPair(user.Id, product.AccountProductId));
                    if (statusResult.Status == UnassignStatus.Ok)
                    {
                        await NotificationManager.ProductUnassigned(accountId, product, user);
                    }

                    if (statusResult.Status != UnassignStatus.Ok)
                    {
                        return Conflict();
                    }
                }

                product = await _authProduct.OwnerProductDetailsGetAsync(new AccountProductPair(accountId, product.AccountProductId));

                return Ok(ProductConvertor.OwnerAccountProductConvertor(product));
            }, accountProductId, true));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> OwnerProductResendAssignInvitation(AuthIdViewModel model, Guid accountProductId)
        {
            return(await OwnerProductExecuteAsync(async delegate(Guid accountId, ViewOwnerProduct product)
            {
                var user = await _auth.AccountGetAsync(model.AccountId);
                if (!object.Equals(user, null) && !product.IsFree && !product.IsTrial && !product.IsDisabled && accountId != user.Id)
                {
                    await NotificationManager.ProductAssigned(accountId, product, user);
                }
                else
                {
                    return Conflict();
                }

                return Ok();
            }, accountProductId));
        }