Exemple #1
0
        public async Task OnGet(Guid?cid)
        {
            await HttpContext.Session.LoadAsync();

            var userId = HttpContext.Session.GetString(UserAccountBusiness.UserAccountSessionkey);

            if (cid != null)
            {
                contentEntry = await contentBusiness.GetContentById(cid.Value);

                if (contentEntry.Order > 1)
                {
                    if (string.IsNullOrEmpty(userId))
                    {
                        NeedPay = true;
                    }
                    else
                    {
                        var _userId   = Guid.Parse(userId);
                        var payapiLog = userAccountBusiness.userAccountAccessor.All <PayAPILog>().FirstOrDefault(x => x.UserAccountId == _userId);
                        if (payapiLog == null)
                        {
                            NeedPay = true;
                        }
                        else
                        {
                            if (payapiLog.EndTime == null || payapiLog.EndTime < DateTime.Now)
                            {
                                NeedPay = true;
                            }
                        }
                    }
                }
                NextCid = await contentBusiness.GetNextContentId(contentEntry);

                PrevCid = await contentBusiness.GetPrevContentId(contentEntry);
            }
            else
            {
                NotFound();
            }
        }