0
I’m using C#
/EF
/Angular
, in my backend I have the following method, which waits for 02 parameters:
public dynamic save(Entidades.CheckList json, Entidades.CheckList json1)
{
master = new ClassMaster();
Entidades.CheckList checkListModel = new Entidades.CheckList();
CheckListDTO checkListDto = new CheckListDTO();
return checkListDto.save(checkListModel, master.contexto);
}
in the controller
angular, I have this method:
$scope.Salvar = function (json, json1) {
$http.post("http://localhost:55959/CheckList/save", json, json1)
.success(function (data) {
if (data == "200") {
alert("Cadastro realizado com sucesso");
}
else
alert(data);
})
.error(function (error) {
alert("Erro");
});
};
in my view, I’m going through it like this:
<div class="md-card-content" style="display: none;">
<div class="uk-width-medium-1-2">
<label>CNPJ</label>
<input id="cnpj1" class="md-input" type="text" required name="cli_cod" md-input="" ng-model="cliente.codigo">
</div>
<div class="uk-width-medium-1-2">
<label>CNPJ</label>
<input id="PBMS1" class="md-input" type="text" required name="cli_nov" md-input="" ng-model="cliente.novartis">
</div>
<div class="uk-width-medium-1-2">
<label>CNPJ</label>
<input id="User2" class="md-input" type="text" required name="user_cod" md-input="" ng-model="user.codigo">
</div>
<div class="uk-width-medium-1-2">
<label>CNPJ</label>
<input id="PBMS2" class="md-input" type="text" required name="user_nov" md-input="" ng-model="user.novartis">
</div>
</div>
<!--ng-click="salvarCliente(cliente)"-->
<div class="uk-clearfix uk-margin-large-top">
<button class="md-btn md-btn-primary uk-float-right" type="submit" ng-click="Salvar(user,cliente)">Salvar</button>
</div>
The problem is it’s only sent to the backend, one of the json
, is not sent both, as I do so that the method of controller
of Angular
send both json
?
Thanks Celsom, axei this link Aki: that solved my life, stay the tip there for colleagues: link
– alessandre martins
@alessandremartins actually the link you showed has the same solution I presented. The difference is that here I am placing more than one array on the same object.
– celsomtrindade
Got it Celsom, thanks for the help buddy, let’s go.
– alessandre martins