Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. <html ng-app="Crm">
  2. <body ng-controller="CrmCtrl">
  3. <form name="novoCrmForm">
  4. <div class="row">
  5. <div class="form-group text-left col-md-8">
  6. <label for="Nome">Nome <i class="danger">*</i></label>
  7. <input type="text" class="form-control" ng-model="empresaParticipante.NOME_FANTASIA" ng-required="true" name="NOME_FANTASIA" placeholder="Nome">
  8. </div>
  9. <div class="form-group text-left col-md-4">
  10. <label for="cpf">CPF</label>
  11. <input type="text" class="form-control" ng-model="empresaParticipante.CNPJ_CPF" name="CNPJ_CPF" placeholder="CPF">
  12. </div>
  13. </div>
  14. <div class="row">
  15. <div class="form-group text-left col-md-6">
  16. <label for="Telefone">Telefone</label>
  17. <input type="tel" class="form-control" ng-model="empresaParticipante.TELEFONE_01" name="TELEFONE_01" placeholder="Telefone">
  18. </div>
  19. <div class="form-group text-left col-md-6">
  20. <label for="Celular">Celular <i class="danger">*</i></label>
  21. <input type="text" class="form-control" ng-model="empresaParticipante.CELULAR" ng-required="true" name="CELULAR" placeholder="Celular">
  22. </div>
  23. </div>
  24. <div class="row">
  25. <div class="form-group text-left col-md-12">
  26. <label for="Email">Email <i class="danger">*</i></label>
  27. <input type="email" class="form-control" ng-model="empresaParticipante.EMAIL" ng-required="true" name="EMAIL" placeholder="Email">
  28. </div>
  29. </div>
  30. </form>
  31. </div>
  32. </div>
  33.  
  34. <button class="btn btn-info" data-dismiss="modal" ng-click="adicionarRegistro(empresaParticipante)" ng-disabled="novoCrmForm.$invalid">Salvar</button>
  35.  
  36. var crmApp = angular.module("Crm", []);
  37. crmApp.controller("CrmCtrl", function ($scope, $http) {
  38.  
  39.  
  40. $scope.adicionarRegistro = function (empresaParticipante) {
  41. $http.post("http://localhost:50183/api/crm/salvar", JSON.stringify(empresaParticipante)).success(function (data) {
  42. delete $scope.empresaParticipante;
  43. $scope.novoCrmForm.$setPristine();
  44. console.log(empresaParticipante);
  45. carregarRegistros();
  46. });
  47. };
  48.  
  49. carregarRegistros();
  50. });
  51.  
  52. {"NOME_FANTASIA":"bruno","CNPJ_CPF":"111.222.333-44","TELEFONE_01":"(000) 00000-0011","CELULAR":"(000) 00000-0022","EMAIL":"teste@teste.com.br"}
  53.  
  54. {"mensagem":"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities
  55. may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId
  56. =472540 for information on understanding and handling optimistic concurrency exceptions.","objeto":null
  57. ,"lista":[],"status":false}
  58.  
  59. [Route("salvar")]
  60. [HttpPost]
  61. public HttpResponseMessage post([FromBody] EMPRESAS_PARTICIPANTES empresaParticipante)
  62. {
  63. IEmpresas_ParticipantesBO Empresas_ParticipantesBO = new Empresas_ParticipantesBO();
  64. Retorno retorno = new Retorno();
  65.  
  66. try
  67. {
  68. //salvar
  69. retorno = Empresas_ParticipantesBO.salvar(empresaParticipante);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement