forked from LearnCodeToday/TutorialOnNodeJs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewProductService.js
More file actions
57 lines (34 loc) · 1.57 KB
/
viewProductService.js
File metadata and controls
57 lines (34 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
angular.module("productModule")
.factory("productService", productService);
productService.$inject = ['$http', '$location', 'productCategoryService' ];
function productService($http, $location, productCategoryService) {
return {
createProduct : function (product) {
return $http.post('/api/createProduct',
{
productCategoryId : product.productCategoryId,
productCost : product.productCost,
name : product.name,
description : product.description,
productPrice : product.productPrice,
productImage : product.productImage
}
);
},
deactivateProduct : function(product) {
return $http.put('api/deactiveProduct/' + product.ProductId);
},
getAllProducts : function(){
return $http.get('/api/getAllProducts');
},
getAllProductCategories : function () {
return productCategoryService.getAllProductCategories();
},
getIdFromEndPoint : function () {
var absoluteUrl = $location.absUrl();
var segments = absoluteUrl.split("/");
var productCategoryId = segments[segments.length - 1];
return productCategoryId
}
}
}