예제 #1
0
    public ActionResult <GenericResponse> ASFEncryptPost([FromBody] ASFEncryptRequest request)
    {
        ArgumentNullException.ThrowIfNull(request);

        if (string.IsNullOrEmpty(request.StringToEncrypt))
        {
            return(BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.StringToEncrypt)))));
        }

        string?encryptedString = Actions.Encrypt(request.CryptoMethod, request.StringToEncrypt);

        return(Ok(new GenericResponse <string>(encryptedString)));
    }
예제 #2
0
        public ActionResult <GenericResponse> ASFEncryptPost([FromBody] ASFEncryptRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (string.IsNullOrEmpty(request.StringToEncrypt))
            {
                return(BadRequest(new GenericResponse(false, string.Format(Strings.ErrorIsEmpty, nameof(request.StringToEncrypt)))));
            }

            string?encryptedString = Actions.Encrypt(request.CryptoMethod, request.StringToEncrypt !);

            return(Ok(new GenericResponse <string>(encryptedString)));
        }