public IHttpActionResult GetByUser(string userId = null)
        {
            if (string.IsNullOrWhiteSpace(userId))
            {
                if (User.Identity.GetUserId() == null) //current user a erişiyor
                {
                    return(Unauthorized());
                }
                userId = User.Identity.GetUserId();
            }

            var result = _communityService.GetCommunityListByUser(userId);

            return(Ok(result));
        }
Exemplo n.º 2
0
        public ActionResult Communities()
        {
            var userId = User.GetPrincipal()?.User?.Id;

            if (userId.IsNullOrWhiteSpace())
            {
                return(PartialView(new SidebarList <CommunityDto>()));
            }

            var data  = _communityService.GetCommunityListByUser();
            var model = new SidebarList <CommunityDto> {
                Items        = data,
                ActiveUserId = userId
            };

            return(PartialView(model));
        }