コード例 #1
0
ファイル: Api.cs プロジェクト: darkpchela/CourseProject
        public async Task AbortUpload()
        {
            var fileId = HttpContext.Session.GetInt32("fileId");

            if (fileId.HasValue)
            {
                await resourcesManager.DeleteAsync(fileId.Value);
            }
        }
コード例 #2
0
        public async Task <DeleteItemResult> DeleteAsync(DeleteItemModel deleteItemModel)
        {
            var authResult = await authenticatorsStore.DeleteItemModelAuthenticator.AuthenticateAsync(deleteItemModel);

            if (!authResult.Succeed)
            {
                return(new DeleteItemResult(authResult));
            }
            var validResult = await validatorsStore.DeleteItemModelValidator.ValidateAsync(deleteItemModel);

            if (!validResult.Succeed)
            {
                return(new DeleteItemResult(validResult));
            }
            var result       = new DeleteItemResult();
            var itemResource = (await itemsCrudService.GetAsync(deleteItemModel.ItemId)).Resource;
            await itemsCrudService.DeleteAsync(deleteItemModel.ItemId);

            await resourcesManager.DeleteAsync(itemResource);

            return(result);
        }