Send ENUM parameter to C # via JavaScript

0

I'm developing a project in which I have to consume a Web Service in .NET that requires an object with some parameters of type Enum.

The call is made by Javascript as below:

function ConsultarPeriodo(){
	  var metodo = 'ConsultarPeriodo';
	  var url = baseURL.dadoscliente;
	  
	  var param = {		  
			canal : 'LOJA',			
			empresa : 'Teste',            
			loja : '0',
			usuario : 'Teste'            
	  };
	  
	  return $soap.post(url, metodo, { req: param });  
  }

The "channel" and "company" attributes are of the enum type in the .NET Web Service that I'm consuming, so I need to send the parameters so that the web service recognizes the enum attributes.

Enum Code:

 public enum EmpresaType
{

    /// <remarks/>
    Loja1,

    /// <remarks/>
    Loja2,

    /// <remarks/>
    Loja3,
}


public enum CanalType
{

    /// <remarks/>
    LOJA,

    /// <remarks/>
    ECOMMERCE,
}

How would my code look?

Thank you!

    
asked by anonymous 06.03.2017 / 20:48

0 answers