Пример #1
0
        public async Task <ActionResult <IEnumerable <string> > > BatchDelete(ChildBatchDeleteResource childBatchDeleteResource)
        {
            var parentsIds = childBatchDeleteResource.ParentAndIds.Keys.ToList();
            var result     = await GetParents(parentsIds);

            if (!(result is OkResult))
            {
                return(result.Result);
            }
            var parents = result.Value;

            foreach (var parentId in parentsIds)
            {
                var childrenIds = childBatchDeleteResource.ParentAndIds[parentId];
                foreach (var childId in childrenIds)
                {
                    if (!ParentManager.Exists(parents[parentId], childId))
                    {
                        return(NotFound(childId));
                    }
                    ParentManager.Remove(parents[parentId], childId);
                }
            }

            await BatchRepository.ReplaceMany(parents.Values);

            return(Ok(parentsIds));
        }
Пример #2
0
 public virtual async Task <ActionResult <IEnumerable <string> > > BatchDelete(ChildBatchDeleteResource childBatchDeleteResource)
 {
     if (await IsUnauthorized(Operations.Alter))
     {
         return(Unauthorized());
     }
     return(await Application.BatchDelete(childBatchDeleteResource));
 }
Пример #3
0
 public Task <ActionResult <IEnumerable <string> > > BatchDelete(ChildBatchDeleteResource childBatchDeleteResource)
 {
     return(SendMethod <IEnumerable <string> >("batch", HttpMethod.Delete, childBatchDeleteResource));
 }