Last active
December 14, 2015 16:29
-
-
Save gnunicorn/5115745 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////// | |
// when i get object client side javascript | |
//////////////////////////////////////////////////////////////// | |
angular.module('ContentServices', ['ng', 'ngResource']). | |
.factory('Content', function($resource){ | |
return $resource("/api/ContentByGroup/:idGroup"); | |
}) | |
.controller("ContentCtrl", function(Content, $scope) { | |
$scope.content = Content.query(); // or Content.query({idGroup: 1}); | |
$scope.deleteItem = function(item) { // you just post the object form the array | |
item.delete(); | |
}; | |
$scope.setTitle = function(item, new_name) { // real item object and string | |
item.name = new_name; | |
item.$save(); // this updates via post | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////// | |
// Object server side ... vb.net | |
//////////////////////////////////////////////////////// | |
Public Class ContentDto | |
Public Property ContentId As Integer | |
Public Property ContentName As String | |
Public Property ContentDescription As String | |
Public Property ContentPath As String | |
Public Property ContentFile As String | |
Public Property ContentImage As String | |
Public Property ContentType As String | |
Public Property ContentDate As String | |
Public Property ContentDuration As Integer | |
Public Property ContentDepartment As String | |
Public Property ContentPlu As Integer | |
Public Property CommunicationPointGroupId_Fk As Integer | |
Public Overridable Property Elements As List(Of Element) | |
Public Sub New() | |
End Sub | |
Public Sub New(item As Content) | |
ContentId = item.ContentId | |
ContentName = item.ContentName | |
ContentDescription = item.ContentDescription | |
ContentPath = item.ContentPath | |
ContentFile = item.ContentFile | |
ContentImage = item.ContentImage | |
ContentType = item.ContentType | |
ContentDate = item.ContentDate | |
ContentDuration = item.ContentDuration | |
ContentDepartment = item.ContentDepartment | |
ContentPlu = item.ContentPlu | |
End Sub | |
Public Function ToEntity() As Content | |
Dim content As New Content With | |
{ | |
.ContentId = ContentId, | |
.ContentName = ContentName, | |
.ContentDescription = ContentDescription, | |
.ContentPath = ContentPath, | |
.ContentFile = ContentFile, | |
.ContentImage = ContentImage, | |
.ContentType = ContentType, | |
.ContentDate = ContentDate, | |
.ContentDuration = ContentDuration, | |
.ContentDepartment = ContentDepartment, | |
.ContentPlu = ContentPlu | |
} | |
Return content | |
End Function | |
End Class | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment