예제 #1
0
        public async Task <IActionResult> IndexAsync(int iPageId)
        {
            int iUserId = Convert.ToInt32(User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value);
            //Memo entityMemo = await _memoService.SelectAsync(new Memo() { iUserId = iUserId });
            string sGroupName     = "WebSocket_" + User.Identity.Name + "_" + iUserId;
            Memo   entityUserMemo = await RedisMethod.GetUserMemoAsync(sGroupName, -1, () => GetUserMemo(iUserId));

            if (entityUserMemo == null)
            {
                entityUserMemo = new Memo()
                {
                    iUserId = iUserId
                };
                await _memoService.AppendAsync(entityUserMemo, User.Identity.Name);
            }
            ViewBag.Scontent = entityUserMemo.Scontent;
            return(Empty(iPageId));
        }
예제 #2
0
        public async Task <Memo> GetUserMemo(int iUserId)
        {
            Memo enttiyMemo = _memoService.Select(new Memo()
            {
                iUserId = iUserId
            });

            if (enttiyMemo == null)
            {
                enttiyMemo = new Memo()
                {
                    iUserId = iUserId
                };
                await _memoService.AppendAsync(enttiyMemo, Context.User.Identity.Name);
            }
            return(enttiyMemo);
        }