self.submit = function()

in scenarios/aca-internal/bicep/sample-apps/PCF-spring-boot/src/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.controller.js [31:51]


        self.submit = function () {
            var id = self.pet.id || 0;

            var data = {
                id: id,
                name: self.pet.name,
                birthDate: self.pet.birthDate,
                typeId: self.petTypeId
            };

            var req;
            if (id) {
                req = $http.put("api/customer/owners/" + ownerId + "/pets/" + id, data);
            } else {
                req = $http.post("api/customer/owners/" + ownerId + "/pets", data);
            }

            req.then(function () {
                $state.go('ownerDetails', {ownerId: ownerId});
            });
        };