public override void OnActionExecuting(ActionExecutingContext context)
        {
            if (context.ActionArguments.Count != 0)
            {
                long id       = 0;
                var  argument = context.ActionArguments.Values.First();
                if (argument is IdRequest)
                {
                    IdRequest idRequest = argument as IdRequest;
                    id = idRequest.Id;
                }
                else if (argument is DocIdRequest)
                {
                    DocIdRequest docIdRequest = argument as DocIdRequest;
                    id = docIdRequest.DocId;
                }
                else if (argument is OrderIdRequest)
                {
                    OrderIdRequest orderIdRequest = argument as OrderIdRequest;
                    id = orderIdRequest.OrderId;
                }

                if (!_xbService.ValidateDocId(id))
                {
                    Response response = new Response
                    {
                        ResultCode  = ResultCodes.validationError,
                        Description = _localizer["Գործարքի համարը սխալ է։"]
                    };
                    context.Result = ResponseExtensions.ToHttpResponse(response);
                }
            }
        }
Example #2
0
 public IActionResult GetCurrentAccountContractBefore(DocIdRequest request)
 {
     if (ModelState.IsValid)
     {
         SingleResponse <string> response = new SingleResponse <string>();
         response.Result     = _contractManager.GetCurrentAccountContractBefore(request.DocId);
         response.ResultCode = ResultCodes.normal;
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }