Пример #1
0
        public MultiOperationResponse DeleteMultiple([Required, FromBody] MultiOperationRequest request)
        {
            if (request.Setters.HasItems())
            {
                var errors = ForeachMultiple(request.Lites, lite =>
                {
                    var entity = lite.RetrieveAndForget();

                    MultiSetter.SetSetters(entity, request.Setters, PropertyRoute.Root(entity.GetType()));

                    var op = request.GetOperationSymbol(entity.GetType());

                    OperationLogic.ServiceDelete(entity, op, request.ParseArgs(op));
                });

                return(new MultiOperationResponse(errors));
            }
            else
            {
                var errors = ForeachMultiple(request.Lites, lite =>
                {
                    var op = request.GetOperationSymbol(lite.EntityType);
                    OperationLogic.ServiceDelete(lite, op, request.ParseArgs(op));
                });

                return(new MultiOperationResponse(errors));
            }
        }
Пример #2
0
        public EntityPackTS?ConstructFromMany([Required, FromBody] MultiOperationRequest request)
        {
            var type = request.Lites.Select(l => l.EntityType).Distinct().Only() ?? TypeLogic.GetType(request.Type);

            var op     = request.GetOperationSymbol(type);
            var entity = OperationLogic.ServiceConstructFromMany(request.Lites, type, op, request.ParseArgs(op));

            return(entity == null ? null : SignumServer.GetEntityPack(entity));
        }