Esempio n. 1
0
        public async Task <ActionResult> RemoveTagUse(long?id, byte[] rowVersion)
        {
            SystemContract.RequireNotNull(id, "id");
            SystemContract.RequireNotNull(rowVersion, "rowVersion");

            await _tagHandler.RemoveTagUsesAsync(new EntityIdentity(id.Value, rowVersion));

            return(JsonNet(true));
        }
Esempio n. 2
0
        public async Task <ActionResult> RenameTagUse(long?id, byte[] rowVersion, string oldName, string newName)
        {
            SystemContract.RequireNotNull(id, "id");
            SystemContract.RequireNotNullOrWhiteSpace(oldName, "oldName");
            SystemContract.RequireNotNullOrWhiteSpace(newName, "newName");

            var user    = GetUser();
            var request = new RenameTagUseRequest()
            {
                TagUseIdentity = new EntityIdentity(id.Value, rowVersion),
                OwnerId        = user.Id,
                OldName        = oldName,
                NewName        = newName,
            };
            var result = await _tagHandler.RenameTagUseAsync(request);

            var ret = Mapper.Map <TagUseViewModel>(result);

            return(JsonNet(ret));
        }
Esempio n. 3
0
        public async Task <ActionResult> NarrowDetail(
            string tag, string titleSearch = "", int pageIndex = 1, RefListSortKind sort = RefListSortKind.PublishedDateDescending
            )
        {
            SystemContract.RequireNotNull(tag, "tag");
            SystemContract.Require(tag != CoreConsts.UnsetTagName, "$unsetが指定されました");

            /// 非公開設定の確認のため本人でもPublishしか見れないようにする。
            var req = new GetRefListsRequest(
                null, null, null, tag, titleSearch, null, PublishingStatusConditionKind.PublishOnly,
                pageIndex - 1, WebConsts.RefListsPageSize, sort
                );
            var result = await _refListHandler.GetRefListsAsync(req);

            var vm = new PagedRefListsViewModel()
            {
                PageIndex = result.PageIndex + 1,
                PageCount = result.PageCount,
                RefLists  = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists),
            };

            return(JsonNet(vm, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public async Task <ActionResult> NarrowDetail(
            long?id, string titleSearch = "", string tag = null, int pageIndex = 1,
            RefListSortKind sort        = RefListSortKind.PublishedDateDescending
            )
        {
            SystemContract.RequireNotNull(id, "id");

            //var isPublishOnly = !IsCurrentUserId(id.Value); /// Author以外のユーザーの場合、Publishなリストだけを対象にする
            /// 非公開設定の確認のため本人でもPublishしか見れないようにする。
            var req = new GetRefListsRequest(
                id.Value, null, null, tag, titleSearch, null, PublishingStatusConditionKind.PublishOnly,
                pageIndex - 1, WebConsts.RefListsPageSize, sort
                );
            var result = await _refListHandler.GetRefListsAsync(req);

            var vm = new PagedRefListsViewModel()
            {
                PageIndex = result.PageIndex + 1,
                PageCount = result.PageCount,
                RefLists  = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists),
            };

            return(JsonNet(vm, JsonRequestBehavior.AllowGet));
        }