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
|
Imports System.Linq
imports System.Threading
Imports System.Web.Mvc
Imports jTableSampleDatabaseLayer.Hik.JTable.models
Imports jTableSampleDatabaseLayer.Hik.JTable.Repositories
Imports jTableSampleDatabaseLayer.Hik.JTable.Sessions
Namespace CrudPlugInDevelop.Controllers
Public MustInherit Class RepositoryBasedController
Inherits System.Web.Mvc.Controller
#Region "Private/protected fields"
Protected ReadOnly _repository As IRepositoryContainer
#End Region
#Region "Constructor"
Protected Sub New(Optional size As RepositorySize = RepositorySize.Medium, Optional ByVal repositoryKey As String = "commun")
Dim r As New RepositorySesssion
_repository = r.GetRepository(size, repositoryKey)
End Sub
#End Region
#Region "Concours actions"
<HttpGet>
Public Function ConcoursListByFiter(Optional ByVal numero As String = "rien", Optional ByVal typeId As Integer = 0, Optional ByVal natureId As Integer = 0, Optional ByVal titre As Object = "rien", Optional ByVal datee As Date = #12/2/1951#, Optional ByVal jtStartIndex As Integer = 0, Optional ByVal jtPageSize As Integer = 0, Optional ByVal jtSorting As String = "rien") As JsonResult
Try
Dim concoursCount As Integer = _repository.ConcoursRepository.GetConcoursCountByFilter(numero, typeId, natureId, titre, datee)
Dim concours As IEnumerable(Of Concour) = _repository.ConcoursRepository.GetConcoursByFilter(numero, typeId, natureId, titre, datee, jtStartIndex, jtPageSize, jtSorting)
Return Json(New With {Key .Result = "OK", Key .Records = concours, Key .TotalRecordCount = concoursCount}, JsonRequestBehavior.AllowGet)
Catch ex As Exception
Return Json(New With {Key .Result = "ERROR", Key .Message = ex.Message}, JsonRequestBehavior.AllowGet)
End Try
End Function
#End Region
End Class
End Namespace |
Partager