예제 #1
0
    public Task <ActionResult> Remove()
    {
        Console.WriteLine("Dedicated implement of route {0}", this.RouteData.ToString());
        // TODO : validar se entity.getState() é um State de status iniciais que permite exclusão.
        String serviceName = "request";

        return(RequestFilter.GetObject <AspNetCoreWebApi.Entity.Request>(this.User.Identity, this.Request, this.entityManager, serviceName).ContinueWith <ActionResult>(taskOldObj => {
            var obj = taskOldObj.Result;
            return RequestFilter.ProcessDelete <AspNetCoreWebApi.Entity.Request> (this.User.Identity, this.Request, this.entityManager, serviceName).ContinueWith <ActionResult> (taskResponse => {
                ActionResult response = taskResponse.Result;

                if (response is OkResult)
                {
                    RequestState stateOld = RequestProductEndpoint.GetRequestState(this.entityManager, obj.State);
                    RequestState state = RequestProductEndpoint.GetRequestState(this.entityManager, obj.State);
                    List <RequestProduct> list = DbUtils.Find <RequestProduct> (this.entityManager, null, QueryMap.Create().AddNext("crudGroupOwner", obj.CrudGroupOwner).AddNext("request", obj.Id), null, null, null).Result;

                    foreach (RequestProduct requestProduct in list)
                    {
                    }
                }

                return response;
            }).Result;
        }));
    }
예제 #2
0
    public Task <ActionResult> Update([FromBody] AspNetCoreWebApi.Entity.Request newObj)
    {
        Console.WriteLine("Dedicated implement of route {0}", this.RouteData.ToString());
        String serviceName = CaseConvert.UnderscoreToCamel(newObj.GetType().Name, false);

        // TODO : validar se entity.getState() é um State com antecessor e precedente validos.
        return(RequestFilter.GetObject <AspNetCoreWebApi.Entity.Request>(this.User.Identity, this.Request, this.entityManager, serviceName).ContinueWith <ActionResult>(taskOldObj => {
            return RequestFilter.ProcessUpdate(this.User.Identity, this.Request, this.entityManager, serviceName, newObj).ContinueWith <ActionResult>(taskResponse => {
                ActionResult response = taskResponse.Result;

                if (response is OkResult)
                {
                    RequestState stateOld = RequestProductEndpoint.GetRequestState(this.entityManager, taskOldObj.Result.State);
                    RequestState state = RequestProductEndpoint.GetRequestState(this.entityManager, newObj.State);
                    List <RequestProduct> list = DbUtils.Find <RequestProduct>(this.entityManager, null, QueryMap.Create().AddNext("crudGroupOwner", newObj.CrudGroupOwner).AddNext("request", newObj.Id), null, null, null).Result;

                    foreach (RequestProduct requestProduct in list)
                    {
                    }
                }

                return response;
            }).Result;
        }));
    }