예제 #1
0
        public async Task <IActionResult> Get(string id)
        {
            var result = await service.Find(id);

            if (result.User != this.User.GetUserId())
            {
                return(Unauthorized());
            }
            return(Ok(result));
        }
예제 #2
0
        public FilterListDto FindSummary(int id)
        {
            var filter = _domainService.Find(id);

            if (filter == null)
            {
                throw SocialExceptions.FilterNotExists(id);
            }

            var dto = Mapper.Map <FilterListDto>(filter);

            dto.ConversationNum = _domainService.GetConversationNum(filter);
            dto.CreatedByName   = _agentService.GetDisplayName(dto.CreatedBy);

            return(dto);
        }
예제 #3
0
        public async Task <IActionResult> Get(string id, bool expand = true)
        {
            var result = await service.Find(id);

            if (result.User != this.User.GetUserId())
            {
                return(Unauthorized());
            }

            if (expand)
            {
                var filter = await filterService.Find(result.FilterId);

                var model = WidgetModel.FromEntity(result);
                model.Filter = filter;
                return(Ok(model));
            }
            else
            {
                return(Ok(result));
            }
        }